Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Re: unable to connect to mysql db on localhost

Doug Parsons

2004-06-08


A few things to try.

Replace localhost with IP (as a test).

Log into mysql with username and password.

MySQL requires a different entry in the user table for the local connection.

Is MySQL running? (Had to ask.)

Do you have a firewall running on the machine?

Doug
www.parsonstechnical.com


----- Original Message -----
From: "ilasno" <ilasno@(protected)>
To: <tomcat-user@(protected)>
Sent: Tuesday, June 08, 2004 10:33 PM
Subject: unable to connect to mysql db on localhost


> hello,
>
> i'm running tomcat 5.0.16 on debian linux with webmin, which provides
> mysql. i've created a test database, and set up a user with what i
> think are the proper permissions. here's the datasource resource from
> the server.xml that's nested within a context:
>
> <Resource name="jdbc/dbName" auth="Container"
> type="javax.sql.DataSource" />
>
>     <ResourceParams name="jdbc/dbName">
>
>      <parameter>
>         <name>factory</name>
>         <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>       </parameter>
>
>      <parameter>
>         <name>maxActive</name>
>         <value>100</value>
>       </parameter>
>
>      <parameter>
>         <name>maxIdle</name>
>         <value>30</value>
>       </parameter>
>
>      <parameter>
>         <name>maxWait</name>
>         <value>10000</value>
>       </parameter>
>
>      <parameter>
>         <name>username</name>
>         <value>xxxxxx</value>
>       </parameter>
>
>      <parameter>
>         <name>password</name>
>         <value>xxxxxx</value>
>       </parameter>
>
>      <parameter>
>         <name>driverClassName</name>
>         <value>org.gjt.mm.mysql.Driver</value>
>       </parameter>
>
>      <parameter>
>         <name>url</name>
>
<value>jdbc:mysql://localhost/dbName?autoReconnect=true</value>
>       </parameter>
>
>      <parameter>
>         <name>removeAbandoned</name>
>         <value>true</value>
>       </parameter>
>
>      <parameter>
>         <name>logAbandoned</name>
>         <value>true</value>
>       </parameter>
>
>     </ResourceParams>
>
> but when i try to access, i get this exception, taken from the logs for
> that context:
>
> 2004-06-08 19:18:24 AbandonedObjectPool is used
> (org.apache.commons.dbcp.AbandonedObjectPool@(protected))
>   LogAbandoned: true
>   RemoveAbandoned: true
>   RemoveAbandonedTimeout: 300
> org.apache.commons.dbcp.SQLNestedException: Cannot create
> PoolableConnectionFactory, cause:
> java.sql.SQLException: Cannot connect to MySQL server on localhost:3306.
> Is there a MySQL server running on the machine/port you are trying to
> connect to? (java.net.ConnectException)
>   at org.gjt.mm.mysql.Connection.connectionInit(Unknown Source)
>
> incidentally (or maybe not), i have other datasources configured pretty
> much identically that work fine for another context that are connecting
> to remote mysql servers.
>
> any suggestions?
>
> thanks for your time.
>
> --
> ilasno
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
> For additional commands, e-mail: tomcat-user-help@(protected)
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.