> I wrote several servlets that access a MySQL database using a single, > persistent, sychronized connection.
> public static synchronized MySQLConnection getInstance(){ > return theConnection; > } There's no use for synchronized keyword in that method. The method is synchronized, NOT the returned connection. If you want to use a synchronized connection, you should do something like (maybe you do it already): MySQLConnection mConn = MySQLConnection.getInstance(); synchronized ( mConn ) { ... } I've seen somewhere simple conn-pools that are used like this: List connList = new Vector(); //List holding the connections doXXX, service etc...: 1. remove the last element (connection) from the list. 1.1 if list was empty, create new connection. 2. use database with that connection. 3. put the connection back to list. //1. : conn = null; synchronized ( connList ) { if ( connList.isEmpty() ) { //1.1 conn = ... } else { conn = (Connection) connList.remove( connList.size() - 1 ); } } //2. : //Do the DB //3. : connList.add( conn ); 1.1 should also contain some sort of maxConnection -limitation. I hope this gave you some idea... -clapu ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html