4 messages in com.mysql.lists.javaRe: Help: Urgent
FromSent OnAttachments
Kishor Patil26 Aug 2004 09:21 
Jeff Mathis26 Aug 2004 09:44 
Mark Matthews26 Aug 2004 09:49 
Hollerman Geralyn M26 Aug 2004 09:53 
Subject:Re: Help: Urgent
From:Mark Matthews (ma@mysql.com)
Date:08/26/2004 09:49:45 AM
List:com.mysql.lists.java

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Kishor Patil wrote:

Does mysql Connector/J support transaction? I am using mysql-connector-java-3.0.14-production-bin.jar driver. and 5.0-alpha server. But still queries dont rollback. Sample code: con.setAutoCommit(false); String query = "insert into cat_operation values(3,'ex1','N')"; java.sql.Statement statement = con.createStatement(); statement.executeUpdate(query); con.rollback(); //con.commit(); System.out.println("End");

What could be the reason?

My guess is you aren't using transaction-safe tables. The default table type in MySQL is 'myisam', which doesn't do transactions.

You need to use the 'innodb' table type, which you do either by specifying that when you create the table by adding 'type=innodb' to the end of your create statement, or by altering the table to that type:

ALTER TABLE foo TYPE=innodb

-Mark

- -- Mr. Mark Matthews MySQL AB, Software Development Manager, J2EE and Windows Platforms Office: +1 708 332 0507 www.mysql.com

MySQL Guide to Lower TCO http://www.mysql.com/it-resources/white-papers/tco.php -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBLhS/tvXNTca6JD8RAv3TAJ0WeHzFYVFTTt6kFcKwJCHduW5Q0QCgpcyI lX64IfbYZEPKBBbK7izFSw4= =MnP+ -----END PGP SIGNATURE-----