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="someu sername";
String password="somep assword";
String driver="org.gjt .mm.mysql.Drive r";
try {
// load db driver
Class.forName (driver);
// establish net connection to db
this.connection =DriverManager. getConnection (url, username,
password);
} catch (ClassNotFoundE xception cnfe) {
System.err.prin tln ("Error loading driver: " + cnfe);
} catch (SQLException sqle) {
System.err.prin tln ("Error connection: " + sqle);
}
}
public Connection getConnection () {
if (this.connectio n==null) {
this.connect ();
}
return this.connection ;
}
and I close the statements, resultsets and connections with
statement.close ();
rs.close();
and connection.clos e;
But when I track "Threads_connec ted" with "show status", I see that the
connections aren't released until the session is terminated with
session.invalid ate();
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