473,387 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Transactions with Java and mySQL

Hello,

I'm trying to port the use of postgresql db to mysql. I'm using
Java and having the following problem - I can't seem to write more
than 1 query per execution. Easier to explain with an example that
worked under postgresql and does not using mysql:

aStatement.executeQuery("BEGIN; DELETE FROM table1; DELETE FROM
table1; DELETE FROM table3; COMMIT;");

If I separate this into 5 different queries it works fine... Any
ideas?? Thanks,

Slawek
Jul 19 '05 #1
6 8097
> I'm trying to port the use of postgresql db to mysql. I'm using
Java and having the following problem - I can't seem to write more
than 1 query per execution. Easier to explain with an example that
worked under postgresql and does not using mysql:

aStatement.executeQuery("BEGIN; DELETE FROM table1; DELETE FROM
table1; DELETE FROM table3; COMMIT;");

If I separate this into 5 different queries it works fine... Any
ideas?? Thanks,


You may want to go to www.mysql.com and read up on the different table types
in the version of mysql you are using. It is probable that your version and
table type will not allow you to group your statements as a transaction.
Jul 19 '05 #2
> I'm trying to port the use of postgresql db to mysql. I'm using
Java and having the following problem - I can't seem to write more
than 1 query per execution. Easier to explain with an example that
worked under postgresql and does not using mysql:

aStatement.executeQuery("BEGIN; DELETE FROM table1; DELETE FROM
table1; DELETE FROM table3; COMMIT;");

If I separate this into 5 different queries it works fine... Any
ideas?? Thanks,


You may want to go to www.mysql.com and read up on the different table types
in the version of mysql you are using. It is probable that your version and
table type will not allow you to group your statements as a transaction.
Jul 19 '05 #3
"sdfgsd" <sd**@sdg.com> wrote in message news:<nR********************@twister.tampabay.rr.c om>...
I'm trying to port the use of postgresql db to mysql. I'm using
Java and having the following problem - I can't seem to write more
than 1 query per execution. Easier to explain with an example that
worked under postgresql and does not using mysql:

aStatement.executeQuery("BEGIN; DELETE FROM table1; DELETE FROM
table1; DELETE FROM table3; COMMIT;");

If I separate this into 5 different queries it works fine... Any
ideas?? Thanks,


You may want to go to www.mysql.com and read up on the different table types
in the version of mysql you are using. It is probable that your version and
table type will not allow you to group your statements as a transaction.


Hi, I've read the mySQL docs regarding table types and it is still
unclear to me if the problem I'm having is to do with table types (and
you were right I use the default table type which does not support
transactions) or with jdbc. As you can see my query, I'm performing
operations on 3 different tables and not on the same one. Therefore
my question is more along on the lines: is there a setting in mySQL
that allows multiple queries at a time? The error I'm getting
indicates an SQL error after the first ";". Thanks.
Jul 19 '05 #4
"sdfgsd" <sd**@sdg.com> wrote in message news:<nR********************@twister.tampabay.rr.c om>...
I'm trying to port the use of postgresql db to mysql. I'm using
Java and having the following problem - I can't seem to write more
than 1 query per execution. Easier to explain with an example that
worked under postgresql and does not using mysql:

aStatement.executeQuery("BEGIN; DELETE FROM table1; DELETE FROM
table1; DELETE FROM table3; COMMIT;");

If I separate this into 5 different queries it works fine... Any
ideas?? Thanks,


You may want to go to www.mysql.com and read up on the different table types
in the version of mysql you are using. It is probable that your version and
table type will not allow you to group your statements as a transaction.


Hi, I've read the mySQL docs regarding table types and it is still
unclear to me if the problem I'm having is to do with table types (and
you were right I use the default table type which does not support
transactions) or with jdbc. As you can see my query, I'm performing
operations on 3 different tables and not on the same one. Therefore
my question is more along on the lines: is there a setting in mySQL
that allows multiple queries at a time? The error I'm getting
indicates an SQL error after the first ";". Thanks.
Jul 19 '05 #5

"Slav" <sl***********@engineer.com> wrote in message
news:2f**************************@posting.google.c om...
"sdfgsd" <sd**@sdg.com> wrote in message

news:<nR********************@twister.tampabay.rr.c om>...
I'm trying to port the use of postgresql db to mysql. I'm using
Java and having the following problem - I can't seem to write more
than 1 query per execution. Easier to explain with an example that
worked under postgresql and does not using mysql:

aStatement.executeQuery("BEGIN; DELETE FROM table1; DELETE FROM
table1; DELETE FROM table3; COMMIT;");

If I separate this into 5 different queries it works fine... Any
ideas?? Thanks,


You may want to go to www.mysql.com and read up on the different table types in the version of mysql you are using. It is probable that your version and table type will not allow you to group your statements as a transaction.


Hi, I've read the mySQL docs regarding table types and it is still
unclear to me if the problem I'm having is to do with table types (and
you were right I use the default table type which does not support
transactions) or with jdbc. As you can see my query, I'm performing
operations on 3 different tables and not on the same one. Therefore
my question is more along on the lines: is there a setting in mySQL
that allows multiple queries at a time? The error I'm getting
indicates an SQL error after the first ";". Thanks.


Ok. I don't think there's a special setting per se. I'm not sure about the
mysql> command line, but I run multiple queries programatically and from
within a .sql file all the time. HTH.
Jul 19 '05 #6

"Slav" <sl***********@engineer.com> wrote in message
news:2f**************************@posting.google.c om...
"sdfgsd" <sd**@sdg.com> wrote in message

news:<nR********************@twister.tampabay.rr.c om>...
I'm trying to port the use of postgresql db to mysql. I'm using
Java and having the following problem - I can't seem to write more
than 1 query per execution. Easier to explain with an example that
worked under postgresql and does not using mysql:

aStatement.executeQuery("BEGIN; DELETE FROM table1; DELETE FROM
table1; DELETE FROM table3; COMMIT;");

If I separate this into 5 different queries it works fine... Any
ideas?? Thanks,


You may want to go to www.mysql.com and read up on the different table types in the version of mysql you are using. It is probable that your version and table type will not allow you to group your statements as a transaction.


Hi, I've read the mySQL docs regarding table types and it is still
unclear to me if the problem I'm having is to do with table types (and
you were right I use the default table type which does not support
transactions) or with jdbc. As you can see my query, I'm performing
operations on 3 different tables and not on the same one. Therefore
my question is more along on the lines: is there a setting in mySQL
that allows multiple queries at a time? The error I'm getting
indicates an SQL error after the first ";". Thanks.


Ok. I don't think there's a special setting per se. I'm not sure about the
mysql> command line, but I run multiple queries programatically and from
within a .sql file all the time. HTH.
Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Lodewijk Voge | last post by:
hello, MySQL lets CURRENT_TIMESTAMP tick on inside transactions. I'm wondering why? doesn't this violate the atomicity of transactions? thank you, Lodewijk
0
by: Thomas Svenson | last post by:
I'm looking for any online resources/tutorials and such about transactions. Preferable for MySQL, but others will do. Other than that, is there any good book about transactions. Again preferable...
0
by: Heikki Tuuri | last post by:
Hi! Many people have complained over years that Borland's dbExpress driver does not work with MySQL and transactions, because it disconnects from mysqld after each SQL statement. The postings...
0
by: Slav | last post by:
Hello, I'm trying to port the use of postgresql db to mysql. I'm using Java and having the following problem - I can't seem to write more than 1 query per execution. Easier to explain with an...
5
by: princevejita1 | last post by:
Hello I have problem with my MySQL server and transactions. I installed MySQL server 5.0.11 with MySQL administrator & MySql Query Browser on Win XP Prof. I would like to use transactions, so I...
2
by: saran | last post by:
I am having a problem with MySQL consuming a lot of memory and eventually throwing an Out of Memory error and restarting itself. The symptoms are that swap usage continues to rise until some...
0
by: Patrox | last post by:
hi ! in mysql doc it is stated that : "MySQL supports local transactions (within a given client connection) " ref : http://dev.mysql.com/doc/refman/5.1/en/transactional-commands.html but what...
9
by: =?iso-8859-1?B?Sm/jbyBNb3JhaXM=?= | last post by:
Hi there guys, My doubt is related with MySQL and Transactions (InnoDB) so here it goes: I have a query like this: $query = 'START TRANSACTION; '; $query .= 'UPDATE sections '; $query .=...
14
realin
by: realin | last post by:
Hiya all, after my 1-2 weeks research i finally found a more consistent way to fire mysql queries in php i.e. transactions. I have two options to insert data in multiple tables :: 1) through...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.