tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Cherouvim>
Subject Re: cannot setup JNDI with MySQL
Date Thu, 06 Oct 2005 11:38:23 GMT
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> 
      <parameter> <name>password</name> <value>john</value>
      <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>

somewhere in the <GlobalNamingResources> element of my server.xml.
The tutorial at 
"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.


Hassan Schroeder wrote:

>John Cherouvim wrote:
>>I've been trying to setup a mysql connection pool using JNDI as shown in
>>But no luck.
>>*What I get in tomcat\logs\stdout.log is:
>> Connection refused: connect
>>   at 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:
For additional commands, e-mail:

View raw message