Hmmm...  I haven't read that tutorial in a while but if that's what it
says, it's wrong.  The <Resource> and <ResourceParams> elements should
be placed between <Context> and </Context> tags of your context xml
file.  That would make the resource only available to that one
application as opposed to being available to all webapps in that Tomcat
instance.

--David

John Cherouvim wrote:

> Thanks for your answers.
>
> I can connect to MySQL using any mysql tool and even with telnet
> localhost 3306 from the command line. I even tried connecting to
> another mysql server running on another pc in my LAN but nothing.
>
> @andy: yes I have placed mysql-connector-java-3.1.10-bin.jar in
> common\lib and I also tried with different (older) versions. I've been
> leaving only one of them of course each time I tried.
>
> I finally managed to solve the problem.
> I needed to place:
>    <Resource name="jdbc/TestDB" type="javax.sql.DataSource"/>
>    <ResourceParams name="jdbc/TestDB">
>      <parameter> <name>url</name>
> <value>jdbc:mysql://localhost:3306/dea?autoReconnect=true</value>
> </parameter>
>      <parameter> <name>password</name> <value>john</value> </parameter>
>      <parameter> <name>maxActive</name> <value>4</value> </parameter>
>      <parameter> <name>maxWait</name> <value>5000</value> </parameter>
>      <parameter> <name>driverClassName</name>
> <value>com.mysql.jdbc.Driver</value> </parameter>
>      <parameter> <name>maxIdle</name> <value>2</value> </parameter>
>      <parameter> <name>username</name> <value>john</value> </parameter>
>    </ResourceParams>
>
> somewhere in the <GlobalNamingResources> element of my server.xml.
> The tutorial at
> http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
> says:
> "Add this in between the |</Context>| tag of the examples context and
> the |</Host>| tag closing the localhost definition."
>
> Which I cannot understand where exctly it means. I was always trying
> to place it somewhere inside the <Host> element which was not working
> for me.
>
> I solved the problem by adding the DataSource from the administration
> tool of tomcat and then I went to server.xml to see how it did it.
>
> Regards,
> J.
>
>
> Hassan Schroeder wrote:
>
>> John Cherouvim wrote:
>>
>>  
>>
>>> I've been trying to setup a mysql connection pool using JNDI as
>>> shown in
>>> http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
>>>
>>> But no luck.
>>>   
>>
>>
>>  
>>
>>> *What I get in tomcat\logs\stdout.log is:
>>> NotifyUtil::java.net.ConnectException: Connection refused: connect
>>>   at java.net.PlainSocketImpl.socketConnect(Native Method)
>>>   
>>
>>
>> A "Connection refused" sounds like your driver config is fine but
>> either MySQL isn't running, it's configured with skip-networking,
>> or you've got a firewall/iptables/whatever issue.
>>
>> Can you connect (`telnet localhost 3306`) from the command line?
>>
>>  
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
=======================================
David Smith
Network Operations Supervisor
Department of Entomology
College of Agriculture & Life Sciences
Cornell University
2132 Comstock Hall
Ithaca, NY  14853
Phone: 607.255.9571
Fax: 607.255.0939


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to