-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 John Bateman wrote:
HiNotice ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
First off I would like to say I appreciate all your help very much.
Now, here's what I have.
I installed, and confirmed that it runs properly, the Connector/J v3 drivers. my resin.conf looks like this:
<resource-ref>
<res-ref-name>jdbc/FormsAreUs</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<!-- <res-type>com.mysql.jdbc.jdbc2.optional.MysqlDataSource</res-type> -->
<init-param driver-name="com.mysql.jdbc.Driver"/>
<init-param url="jdbc:mysql://localhost:3306/FormsAreUs"/>
<init-param user="foo"/>
<init-param password="bar"/>
<init-param max-connections="20"/>
<init-param max-idle-time="30"/>
</resource-ref>
And when I 'use' this connection (in this case) I try with of the following example. (For brevity I have removes all 'error' checking etc, suffice it ot say the exception thrown is below).
Now I CAN get it to work with last_insert_id() but I would rather not have to use another round trip to the DB. Here is my code.
Example 1:
String sqlCommand = "INSERT INTO Questions (question, questionTypeID) VALUES ( " + pQuestion.getQuestion() + ", " + pQuestion.getQuestionTypeID() + ")";
Statement stmt2 = conn.createStatement( ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE );
stmt2.executeUpdate( sqlCommand, Statement.RETURN_GENERATED_KEYS );
ResultSet rs2 = stmt2.getGeneratedKeys();
int lastQuestionID = rs2.getInt( 1 );
THROWS: java.lang.AbstractMethodError: com.mysql.jdbc.jdbc2.Statement.executeUpdate(Ljava/lang/String;I)
You have an older version of Connector/J (2.0.14 something or other) laying around in your classpath :(
Make sure you're using the driver from:
http://www.mysql.com/downloads/api-jdbc-dev.html
-Mark
- -- MySQL 2003 Users Conference -> http://www.mysql.com/events/uc2003/
For technical support contracts, visit https://order.mysql.com/?ref=mmma
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mark Matthews <[EMAIL PROTECTED]>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java
/_/ /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
<___/ www.mysql.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.1.90 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQE+I08ttvXNTca6JD8RArCPAJ93E9ckNb9syrGQvc+n4fe+SSPgJgCff/vT
CNWI/vr5tcB6LYLtyj13W3w=
=9ZQU
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php