Re: a little disillusioned

Поиск
Список
Период
Сортировка
От David Wilbur
Тема Re: a little disillusioned
Дата
Msg-id D0D0BF92-5126-11D8-9A8D-0003931D9176@cybermesa.com
обсуждение исходный текст
Ответ на Re: a little disillusioned  (David Wilbur <wildboar@cybermesa.com>)
Ответы Re: a little disillusioned
Список pgsql-jdbc
i should also note that i just finished installing mysql and the mysql
jdbc driver and i do have this working for mysql, following verbatim
what is on this page

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-
examples-howto.html

other then the error that Paul noted there isn't much different from
what i can tell for postgres.

On Jan 27, 2004, at 4:52 PM, David Wilbur wrote:

>
> On Jan 27, 2004, at 3:01 PM, Paul Thomas wrote:
>
>>
>> On 27/01/2004 19:07 David Wilbur wrote:
>>> maybe even adding the same advice to the postgres jdbc examples so
>>> that  we would have a starting point that we knew was working for
>>> someone...   this is a nice starting point, but... it might be nice
>>> to add in  something along the line of how to set up a java web
>>> server to use  postgres.
>>
>>
>> The Tomcat 5.0 docs gave the stupid (and I would have thought
>> obvious) typo that exists in the 4.1 doc for PostgreSQL. The web.xml
>> res-ref-name should refer to the matching name in the ResourceParams
>> tag _not_ the physical db name which appears in the JDBC url.
>
> yep i saw that  here are my changes as i thought they should be:
>
> more web.xml
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>     <!DOCTYPE web-app PUBLIC
>     "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
>   <description>PosgreSQL Test App</description>
>   <resource-ref>
>       <description>DB Connection</description>
>       <res-ref-name>jdbc/postgres</res-ref-name>
>       <res-type>javax.sql.DataSource</res-type>
>       <res-auth>Container</res-auth>
>   </resource-ref>
> </web-app>
>
>
> out of server.xml
>
>                 <Context path="/pgtest" docBase="pgtest"  debug="5"
> reloadable="true" crossContext="true">
>
>                   <Logger
> className="org.apache.catalina.logger.FileLogger"
>
> prefix="localhost_DBTest_log." suffix=".txt"
>                                          timestamp="true"/>
>
>                   <Resource name="jdbc/postgres"  auth="Container"
> type="javax.sql.DataSource"/>
>
>                   <ResourceParams name="jdbc/postgres">
>                         <parameter>
>                           <name>factory</name>
>
> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>                         </parameter>
>
>                         <parameter>
>                           <name>maxActive</name>
>                           <value>20</value>
>                         </parameter>
>
>                         <parameter>
>                           <name>maxIdle</name>
>                           <value>10</value>
>                         </parameter>
>
>                         <parameter>
>                           <name>maxWait</name>
>                           <value>10000</value>
>                         </parameter>
>
>                         <parameter>
>                          <name>username</name>
>                          <value>dbuser</value>
>                         </parameter>
>
>                         <parameter>
>                          <name>password</name>
>                          <value>dbpassword</value>
>                         </parameter>
>
>                         <parameter>
>                            <name>driverClassName</name>
>                            <value>org.postgres.Driver</value>
>                         </parameter>
>
>                         <parameter>
>                           <name>url</name>
>
> <value>jdbc:postgresql://127.0.0.1:5432/test</value>
>                         </parameter>
>                   </ResourceParams>
>                 </Context>
>
>
>>
>>> http://www.postgresql.org/docs/current/static/jdbc-datasource.html
>>> i am suspecting that maybe is one of the xml files... either
>>> $CATALINA_HOME/conf/server.xml  or the apps WEB-INF/web.xml... but i
>>>  really don't know for sure what i might have wrong there.  in the
>>> mean  time i guess i will try the mysql setup the tomcat people
>>> define to see  if that works... since i have to do that too.
>>
>> FWIW, you don't really need to edit server.xml. Create a <app.,xml
>> file defining the context of you web app and put it in the webapps
>> directory. Here's a sample which also defines a JDBC realm.
>
> yes, but i thought the whole point of the definition in the server.xml
> file was to have it typed once there and then all you need in the
> web.xml is the reference to it... that way an admin can make one
> change and all that refer to the resource get changed...
>
> thanks, looking  at the following...  they don't seem much different.
>
>>
>> <!-- Tomcat XML file for MyApp context -->
>> <!-- this file is to be placed in the webapps direcory -->
>>
>> <!-- MyApp context -->
>> <Context path="/myapp"       docBase="myapp.war"         debug="0"
>>    reloadable="true"
>>  crossContext="true">
>>
>> <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="0"
>>        driverName="org.postgresql.Driver"
>>            digest="MD5"
>>     connectionURL="jdbc:postgresql://127.0.0.1:5432/my_physical_db"
>>    connectionName="dbuser" connectionPassword="dbpasswd"
>>         userTable="user_table" userNameCol="login_name"
>> userCredCol="password"
>>     userRoleTable="user_roles" roleNameCol="role" />
>>
>> <Resource name="jdbc/aniceDB" auth="Container"
>>       type="javax.sql.DataSource"/>     <ResourceParams
>> name="jdbc/aniceDB">
>>     <parameter>
>>         <name>factory</name>
>>          <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>>     </parameter>
>>     <parameter>
>>         <name>driverClassName</name>
>>         <value>org.postgresql.Driver</value>
>>     </parameter>
>>     <parameter>
>>         <name>url</name>
>>          <value>jdbc:postgresql://127.0.0.1:5432/my_physical_db</value>
>>     </parameter>
>>     <parameter>
>>         <name>username</name>
>>         <value>dbuser</value>
>>     </parameter>
>>     <parameter>
>>         <name>password</name>
>>         <value>dbpasswd</value>
>>     </parameter>
>>     <parameter>
>>         <name>maxActive</name>
>>         <value>10</value>
>>     </parameter>
>>     <parameter>
>>         <name>maxIdle</name>
>>         <value>1</value>
>>     </parameter>
>>     <parameter>
>>         <name>maxWait</name>
>>         <value>30000</value>
>>     </parameter>
>>     <parameter>
>>         <name>removeAbandoned</name>
>>         <value>true</value>
>>     </parameter>
>>     <parameter>
>>         <name>removeAbandonedTimeout</name>
>>         <value>60</value>
>>     </parameter>
>>     <parameter>
>>         <name>logAbandoned</name>
>>         <value>true</value>
>>     </parameter>
>>     </ResourceParams> </Context>
>>
>> And here's part of the app's web.xml which defines the datasource
>>
>>
>>     <resource-ref>
>>         <description>
>>         Resource reference to a factory for java.sql.Connection
>>         instances that may be used for talking to a particular
>>         database that is configured in the server.xml file.
>>         </description>
>>         <res-ref-name>jdbc/aniceDB</res-ref-name>
>>         <res-type>javax.sql.DataSource</res-type>
>>         <res-auth>Container</res-auth>
>>     </resource-ref>
>>
>>
>> HTH
>>
>> -- Paul Thomas
>> +------------------------------
>> +---------------------------------------------+
>> | Thomas Micro Systems Limited | Software Solutions for the Smaller
>> Business |
>> | Computer Consultants         |
>> http://www.thomas-micro-systems-ltd.co.uk   |
>> +------------------------------
>> +---------------------------------------------+
>>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: David Wilbur
Дата:
Сообщение: Re: a little disillusioned
Следующее
От: David Wilbur
Дата:
Сообщение: Re: a little disillusioned