Hi David,

Thank you so much for the response and good advice.
I verified that I was able to connect to MySQL using
the command you suggested (via port 3306). I also
removed the autoReconnect parameter and moved the
pooling config out to Catalina/localhost/DBTest.xml. I
restarted tomcat and I'm still having the same issue.

Do you have any other ideas?

Thanks again,

Ty



--- David Smith <[EMAIL PROTECTED]> wrote:

> For starters, you might want to make a copy of your
> server.xml file for 
> documentation purposes and then drop all the
> comments from the active 
> one.  The documentation comments are excellent, but
> they make the 
> serverl.xml near impossible to read.
> 
> At any rate.... the exception is connection refused.
>  Are you sure your 
> MySQL server is listening on port 3306?  Some
> default configurations use 
> unix sockets exclusively -- something java JDBC
> drivers can't do.  Try 
> this from the same machine your server is on:
> 
> mysql -h localhost -P 3306 -u rpd -p
> 
> The above command forces mysql client to connect via
> TCP/IP with userid 
> rpd and prompt for a password.  If this works, then
> we're looking at 
> something else.  If this doesn't, reconfigure your
> mysql server to 
> listen on tcp/ip port 3306 and try again.
>  
> Some additional recommendations -- not directly
> related to your issue, 
> but worth mentioning:
> 
> The <Context ...> ... </Context> block should be in
> it's own xml file 
> under conf/Catalina/localhost, named to match the
> context of your webapp 
> -- DBTest.xml in your case.  Avoid setting this in
> server.xml as it 
> requires restarting the tomcat container every time
> you want to make a 
> change to your webapp's config.
> 
> Drop the autoReconnect=true from your database url. 
> It isn't 
> recommended by MySQL and doesn't make sense in a
> database connection 
> pool anyway.
> 
> --David
> 
> tyju tiui wrote:
> > I'm having problems setting up connection pooling
> with
> > comcat 5.5.2.0 and MySQL 5.0.24 using mysql
> > connector/J 5.0.
> >
> > I've setup / populated a test database and
> verified
> > that I can login to the server/db using the
> specified
> > username/password/host found in the connection
> string.
> > My server.xml looks like this:
> >
> >   
>   <snipped here .... a lot of irrelevant stuff to
> the issue at hand. />
> >         <!-- ********** Pooling Config **********
> -->
> >         <Context path="/DBTest" docBase="DBTest"
> >                  debug="5" reloadable="true"
> > crossContext="true">
> >
> >
> >   
> < snipped again...../>
> >             <Resource name="jdbc/TestDB"
> >                       auth="Container"
> >                       type="javax.sql.DataSource"
> >                      
> >
>
factory="org.apache.commons.dbcp.BasicDataSourceFactory"
> >                       maxActive="100"
> >                       username="rpd"
> >                       password="2wERk4rpd"
> >                       maxIdle="30"
> >                       maxWait="10000"
> >                      
> > driverClassName="com.mysql.jdbc.Driver"
> >                       removeAbandoned="true"
> >                      
> >
>
url="jdbc:mysql://localhost:3306/phptest?autoReconnect=true"
> >                       />
> >
> >         </Context>
> >         <!-- ********** End Pooling ********** -->
> >
> >       </Host>
> >
> >     </Engine>
> >
> >   </Service>
> >
> > </Server>
> >
> >
> >
> >
> >
> >
> >
> > I'm using the sample web.xml and test.jsp found
> at:
> >
>
http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html
> >
> >
> >
> >
> >
> >
> > There error I'm getting is:
> >
> > org.apache.jasper.JasperException: Unable to get
> > connection, DataSource invalid:
> > "org.apache.commons.dbcp.SQLNestedException:
> Cannot
> > create PoolableConnectionFactory (Server
> connection
> > failure during transaction. Due to underlying
> > exception: 'java.net.SocketException:
> > java.net.ConnectException: Connection refused'.
> >
> > ** BEGIN NESTED EXCEPTION ** 
> >
> > java.net.SocketException
> > MESSAGE: java.net.ConnectException: Connection
> refused
> >
> > STACKTRACE:
> >
> > java.net.SocketException:
> java.net.ConnectException:
> > Connection refused
> >     at
> >
>
com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
> >     at
> com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
> >     at
> >
>
com.mysql.jdbc.Connection.createNewIO(Connection.java:2815)
> >     at
> >
>
com.mysql.jdbc.Connection.<init>(Connection.java:1531)
> >     at
> >
>
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
> >     at
> >
>
org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)
> >     at
> >
>
org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
> >     at
> >
>
org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)
> >     at
> >
>
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
> >     at
> >
>
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
> >     at
> >
>
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(Unknown
> > Source)
> >     at
> >
>
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(Unknown
> > Source)
> >     at
> >
>
org.apache.jsp.test_jsp._jspx_meth_sql_query_0(test_jsp.java:100)
> >     at
> >
>
org.apache.jsp.test_jsp._jspService(test_jsp.java:58)
> >     at
> >
>
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> >     at
> >
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> >     at
> >
>
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> >     at
> >
>
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> >     at
> >
>
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> 
=== message truncated ===



 
____________________________________________________________________________________
Sponsored Link

$420k for $1,399/mo. 
Think You Pay Too Much For Your Mortgage? 
Find Out! www.LowerMyBills.com/lre

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to