Hello,
I am having some performance difficulties due to the number of
connections getting so high. I know that the correct way to solve this
is by using connection pooling, but for now I can't figure out why the
connections are'nt being released as I expect.
I am using Tomcat 4.0, with mm.mysql-2.0.14-bin.jar on Linux 7.2 to
connect to a MySQL max 3.23.51 database. I open the connections in a
bean with:
private void connect () {
String url="jdbc:mysql://mysqlserver/database";
String username="someusername";
String password="somepassword";
String driver="org.gjt.mm.mysql.Driver";
try {
// load db driver
Class.forName (driver);
// establish net connection to db
this.connection=DriverManager.getConnection (url, username,
password);
} catch (ClassNotFoundException cnfe) {
System.err.println ("Error loading driver: " + cnfe);
} catch (SQLException sqle) {
System.err.println ("Error connection: " + sqle);
}
}
public Connection getConnection () {
if (this.connection==null) {
this.connect ();
}
return this.connection;
}
and I close the statements, resultsets and connections with
statement.close();
rs.close();
and connection.close;
But when I track "Threads_connected" with "show status", I see that the
connections aren't released until the session is terminated with
session.invalidate();
Any insights?
Thanks,
Bill
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw