4 messages in com.mysql.lists.win32Re: java.net.BindException in XP/JDBC
FromSent OnAttachments
Jan Gifvars04 Mar 2003 03:09 
Keith Hatton04 Mar 2003 03:44 
Mark Matthews04 Mar 2003 05:58 
Mark Matthews05 Mar 2003 20:21 
Subject:Re: java.net.BindException in XP/JDBC
From:Mark Matthews (ma@mysql.com)
Date:03/04/2003 05:58:36 AM
List:com.mysql.lists.win32

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Jan Gifvars wrote:

Hello,

I have some problem running a simple java program on Windows/XP connecting to MySql 3.23.51-nt With mysql-connector-java-3.0.6-stable JDBC-driver. What happens is that I get a "java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.BindException: Address already in use: connect" What I can understand I close all possible things there is to close, statement, connection and resultset. And its always close to 3 960 iterations I get the exception. Of course I can implement a connection pool, but I thought that was standard in JDBC 2.0 drivers. I'm not running "named pipes". Seems to me that this driver don't close its sockets correctly, well, a wild guess anyway.

Anyone got a clue?

I'm pretty sure the driver closes its sockets correctly upon close. You should be calling .close() in the reverse order of creation though :)

I do question why you need to create a new connection through each iteration, though, that seems wasteful, and it will really kill performance...There is an overhead to connecting (admittedly less so with MySQL than other RDBMSs), and the connection is re-usable.

-Mark

- -- MySQL 2003 Users Conference -> http://www.mysql.com/events/uc2003/

For technical support contracts, visit https://order.mysql.com/?ref=mmma

iD8DBQE+ZLEjtvXNTca6JD8RAjutAJ9PD7l6UKZTaw/IEPXMz2ZB7sEbTACgqjh0 a0zWwtOAe/0rKLRzSE314zg= =kNS1 -----END PGP SIGNATURE-----