You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Knight, Digby" <Di...@hen.invesco.com> on 2003/04/25 10:44:32 UTC

BindException connecting to MySQL with a Tomcat DataSource

Hi,

Just wondering if anyone has come across a BindException when trying to
connect to MySQL (3.2 or 4.0) using a DataSource resource set up in
server.xml?

I can connect quite happily doing a normal Class.forName(...);
DriverManager.getConnection(...),  and I can also get the reference to the
DataSource okay - it just fails when I do the dataSource.getConnection,
giving me the following exception:

"java.sql.SQLException: Unable to connect to any hosts due to exception:
java.net.BindException: Address already in use: connect" 

The stack trace seems to indicate that it's failing somewhere in the DBCP
classes.

The odd thing is that I've been connecting quite happily with this method
for months and it's suddenly stopped working, although I'm not sure what I
had just done when it happened - it may have been upgrading to Tomcat
4.1.24, so I might try installing an earlier version. Seems unlikely that
this hasn't been spotted by anyone else though.

Could it be the MySQL Connector/J JDBC driver? I was using the older mm
driver a while ago, although again I can't remember whether that coincided
with the connection failing.

Anyone got any ideas? It's driving me mad.

Thanks in advance.

Digby


*****************************************************************
The information in this email and in any attachments is 
confidential and intended solely for the attention and use 
of the named addressee(s). This information may be 
subject to legal professional or other privilege or may 
otherwise be protected by work product immunity or other 
legal rules.  It must not be disclosed to any person without 
our authority.

If you are not the intended recipient, or a person 
responsible for delivering it to the intended recipient, you 
are not authorised to and must not disclose, copy, 
distribute, or retain this message or any part of it.
*****************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: BindException connecting to MySQL with a Tomcat DataSource

Posted by Tim Funk <fu...@joedog.org>.
Try this:
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=mysql+%22java.sql.SQLException%3A+Unable+to+connect+to+any+hosts+due+to+exception%22&btnG=Google+Search
Google search term:  mysql "java.sql.SQLException: Unable to connect to any 
hosts due to exception"

Brings many possible answers.

-Tim


Knight, Digby wrote:
> Hi,
> 
> Just wondering if anyone has come across a BindException when trying to
> connect to MySQL (3.2 or 4.0) using a DataSource resource set up in
> server.xml?
> 
> I can connect quite happily doing a normal Class.forName(...);
> DriverManager.getConnection(...),  and I can also get the reference to the
> DataSource okay - it just fails when I do the dataSource.getConnection,
> giving me the following exception:
> 
> "java.sql.SQLException: Unable to connect to any hosts due to exception:
> java.net.BindException: Address already in use: connect" 
> 
> The stack trace seems to indicate that it's failing somewhere in the DBCP
> classes.
> 
> The odd thing is that I've been connecting quite happily with this method
> for months and it's suddenly stopped working, although I'm not sure what I
> had just done when it happened - it may have been upgrading to Tomcat
> 4.1.24, so I might try installing an earlier version. Seems unlikely that
> this hasn't been spotted by anyone else though.
> 
> Could it be the MySQL Connector/J JDBC driver? I was using the older mm
> driver a while ago, although again I can't remember whether that coincided
> with the connection failing.
> 
> Anyone got any ideas? It's driving me mad.
> 
> Thanks in advance.
> 
> Digby
> 
> 
> *****************************************************************
> The information in this email and in any attachments is 
> confidential and intended solely for the attention and use 
> of the named addressee(s). This information may be 
> subject to legal professional or other privilege or may 
> otherwise be protected by work product immunity or other 
> legal rules.  It must not be disclosed to any person without 
> our authority.
> 
> If you are not the intended recipient, or a person 
> responsible for delivering it to the intended recipient, you 
> are not authorised to and must not disclose, copy, 
> distribute, or retain this message or any part of it.
> *****************************************************************
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org