List:MySQL and Java« Previous MessageNext Message »
From:Mark Matthews Date:August 26 2004 4:50pm
Subject:Re: Help: Urgent
View as plain text  
-----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-----
Thread
Help: UrgentKishor Patil26 Aug
  • Re: Help: UrgentJeff Mathis26 Aug
    • Re: Help: UrgentHollerman Geralyn M26 Aug
  • Re: Help: UrgentMark Matthews26 Aug