Re: Using com.mysql.jdbc.Connection with tomcat dbcp driver connection pool
Posted by: will crick
Date: February 27, 2005 12:54PM


Thanks for the reply - but i am wanting to use the com.mysql.jdbc.Connection.getLastInsertId() method. This method will make my insertion and retrieval of Unique id's lots easier with the relational database structure i am using (auto-increment columns for the unique id's of records used as foriegn keys in related teables).

Therefore the only way i can see to do this is to somehow return the mysql Connection object from the Tomcat connection pool - but it seems no body else has done this in the past - is this because there is a better way of doing what i want to do???

The other option i have looked at:
Doing a query for the Max value in the ID column / managing the ID's in the code:
I cannot guarantee that the max value is the last record that has been inserted as MySQL re-uses values that may have been deleted from the auto-increment field. Also i cannot gurantee that another record has been inserted by another process when my code is running.

Writing my own connection pool to use the MySQL classes, but still adhere to the java.sql Interfaces:
Just dont want to do this - as i dont think i can implement db re-connection and time-outs / cleaning up connections etc... as well as others have done before!!!

Any advice apreciated!!



Options: ReplyQuote

Written By
Re: Using com.mysql.jdbc.Connection with tomcat dbcp driver connection pool
February 27, 2005 12:54PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.