| Bug #2354 | JDBC and "Too many connections" | ||
|---|---|---|---|
| Submitted: | 12 Jan 2004 8:24 | Modified: | 12 Jan 2004 8:55 |
| Reporter: | Michel Onoff | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / J | Severity: | S2 (Serious) |
| Version: | 3.0.9 and 3.1.0 | OS: | Windows (Windows 2K) |
| Assigned to: | CPU Architecture: | Any | |
[12 Jan 2004 8:24]
Michel Onoff
[12 Jan 2004 8:45]
Michel Onoff
A sample program that produces the misleading SQLException is:
package test;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class ConnectionCounter {
public static void main(String[] args) {
int connectionCount = 0;
List conns = new ArrayList();
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
System.out.println("now");
while (true) {
conns.add(
DriverManager.getConnection(
"jdbc:mysql://localhost/test",
"root",
""));
++connectionCount;
}
}
catch (SQLException e) {
e.printStackTrace();
System.out.println(e.getErrorCode());
System.out.println(e.getSQLState());
System.out.println(connectionCount);
}
catch (Exception e) {
e.printStackTrace();
}
}
}
[12 Jan 2004 8:55]
Mark Matthews
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.
If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information
about accessing the source trees is available at
http://www.mysql.com/doc/en/Installing_source_tree.html
Additional info:
Please try a nightly build of either 3.0.x or 3.1.x from http://downloads.mysql.com/snapshots.php
The latest versions of the driver read the error message from the server in this case, and it can be retrieved via SQLException.getMessage().
