By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,741 Members | 1,979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,741 IT Pros & Developers. It's quick & easy.

MySQL's autocommit

P: n/a
Below is what I got by using MySQL's --log startup option. The original
Java(with JDBC driver) program that creates the queries at runtime was coded
by other people, and unfortunately, they are not available to answer any
question.
My question is: Do we need so many "SET autocommit=1" at all? Bu default,
MySQL always starts a new connection with autocommit
enabled.(?dev.mysql.com/doc/mysql/en/InnoDB_and_.., do we need to do "SET
autocommit=1" ourselves so frequently?
I know it's hard to analyze queries without looking at the program, but
that's what I can do so far. The following queries are simply to insert new
data into two relevant tables. The SELECT statements are to make sure that
no duplicate data(the Java program actually provide the logic).

SET autocommit=1
SELECT * FROM `Document` WHERE Id='000-0448.html'
SET autocommit=1
SELECT * FROM DS WHERE Name='ters-1000'
SET autocommit=1
INSERT INTO `Document` (Id,Title,ModifiedDate,CS,DSID) VALUES
('000-0448.html','000-0448.html','2002-10-30 18:40:22.0',-1,3)
INSERT INTO `DocumentImage` (DocumentID,DocumentText) VALUES (148,'This is a
test')
SET autocommit=1
SELECT * FROM `Document` WHERE Id='000-0454.html'
SET autocommit=1
SELECT * FROM DS WHERE Name='ters-1000'
SET autocommit=1
INSERT INTO `Document` (Id,Title,ModifiedDate,CS,DSID) VALUES
('000-0454.html','000-0454.html','2002-10-30 18:40:22.0',-1,3)
INSERT INTO `DocumentImage` (DocumentID,DocumentText) VALUES (149,'This is
a test')
SET autocommit=1
Jul 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.