The problem is not JDNI. The problem is you can't connect to MySQL. Probably it's you have to check your MySQL access permissions...

Can you connect to MySQL using the same parameters with another tool like MySQL Control Center?

----- Original Message ----- From: "John Cherouvim" <[EMAIL PROTECTED]>
To: <tomcat-user@jakarta.apache.org>
Sent: Thursday, October 06, 2005 11:17 AM
Subject: cannot setup JNDI with MySQL


Hello

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.

I never get to see the datasource registered Tomcat Administration Tool.
I've included in server.xml the following lines somewhere inside the <Host> .. </Host>
<DefaultContext>
<Resource name="jdbc/DBTest" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/DBTest">
<parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>driverClassName</name> <value>com.mysql.jdbc.Driver</value> </parameter> <parameter> <name>url</name> <value>jdbc:mysql://localhost:3306/dea?autoReconnect=true</value> </parameter> <parameter> <name>username</name> <value>myusername</value> </parameter> <parameter> <name>password</name> <value>mypassword</value> </parameter>
   <parameter> <name>maxActive</name> <value>20</value> </parameter>
   <parameter> <name>maxIdle</name> <value>10</value> </parameter>
   <parameter> <name>maxWait</name> <value>40</value> </parameter>
</ResourceParams>
</DefaultContext>

I have Tomcat/5.0.28

And the following files in common\lib
mysql-connector-java-3.1.10-bin.jar
commons-collections-3.1.jar
commons-dbcp-1.2.1.jar
commons-pool-1.2.jar
*

*What I get in tomcat\logs\stdout.log is:
NotifyUtil::java.net.ConnectException: Connection refused: connect
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:295)
   at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:161)
   at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:148)
   at java.net.Socket.connect(Socket.java:425)
   at java.net.Socket.connect(Socket.java:375)
   at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
   at sun.net.www.http.HttpClient.openServer(HttpClient.java:366)
   at sun.net.www.http.HttpClient.openServer(HttpClient.java:582)
   at sun.net.www.http.HttpClient.<init>(HttpClient.java:292)
   at sun.net.www.http.HttpClient.<init>(HttpClient.java:253)
   at sun.net.www.http.HttpClient.New(HttpClient.java:321)
   at sun.net.www.http.HttpClient.New(HttpClient.java:306)
   at sun.net.www.http.HttpClient.New(HttpClient.java:301)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:469) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:460) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:516) at org.netbeans.modules.web.monitor.server.NotifyUtil$RecordSender.run(NotifyUtil.java:237)


What did I miss? I've even tried setting up the JNDI in the conf\Catalina\localhost\myapp.xml And also tried <Context path="/myapp" docBase="app"> instead of <DefaultContext>
I also tried all that with the org.gjt.mm.mysql.Driver

Regards,
I.

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





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

Reply via email to