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?

Best regards,
Jan Gifvars, Veratech AB.
Stockholm.

public void testSimpleQuery()
{
try {
Class.forName("com.mysql.jdbc.Driver").newInstance ();
Properties tProps = new Properties();

tProps.put("user", "root");
tProps.put("password", "myfirstchildsname");

for (int i = 0; i < 9000; i++){
Connection conn = DriverManager.getConnection(
"jdbc:mysql://localhost/groopi", tProps);

String sql = "select * from member";
Statement pst = conn.createStatement();
ResultSet rs = pst.executeQuery(sql);
rs.next();

System.out.println( i + " member " +
rs.getString("cellnumber"));

try{
if (conn != null){
conn.close();
}
}
catch (SQLException e){
}
try{
if (pst != null){
pst.close();
}
}
catch (SQLException e){
}
try{
if (rs != null){
rs.close();
}
}
catch (SQLException e){
}
}

} catch (Exception e) {
e.printStackTrace();

}
}