The moose likes JDBC and Relational Databases and the fly likes mysql autocommit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "mysql autocommit" Watch "mysql autocommit" New topic

mysql autocommit

Natraj Gudla
Ranch Hand

Joined: Feb 09, 2003
Posts: 34
I am unable to switch off the autocommit mode thru my code in java , while connecting to mysql.
here, it commits all the queries which i execute immediately..
and the version of mysql which i am using is 3.23.53 ,
can anyone help me...
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

So are you trying to use transactions? There are a couple of things you need to do.
First, tell us what Driver and what Driver version you are using to access the database. Some drivers don't support some features. I would suggest the latest version of the Connecter/J Driver which is 3.0.8.
Second, what type are your tables in mysql? If I remember correctly, InnoDB is the only type that supports Transactions.

GenRocket - Experts at Building Test Data
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
Does MySQL 3.23 support transactions at all?

Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Natraj Gudla
Ranch Hand

Joined: Feb 09, 2003
Posts: 34
ya, sorry that i did not give the details
I am using the "" class as the driver
and my application requires to connect to the "mysql" database,
create a new database as given by the user
and create a new user , grant privileges to the user on the new database,
and then exit the application.
here i am working on the "user" and the "db" tables of the mysql database , connecting to it using the "root" and with no password.
Justin Chudgar

Joined: Aug 19, 2003
Posts: 1
Make sure that you are not using ISAM or MyISAM tables. they do not support transactions. InnoDB and BDB(?) do. If you have the MySQL Control Center installed you can get the info you need from the table properties.
I agree. Here's the link:
subject: mysql autocommit
It's not a secret anymore!