473,748 Members | 8,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.exec uteQuery("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 8117
> 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.exec uteQuery("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.exec uteQuery("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******* *************@t wister.tampabay .rr.com>...
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.exec uteQuery("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******* *************@t wister.tampabay .rr.com>...
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.exec uteQuery("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.goo gle.com...
"sdfgsd" <sd**@sdg.com > wrote in message

news:<nR******* *************@t wister.tampabay .rr.com>...
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.exec uteQuery("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.goo gle.com...
"sdfgsd" <sd**@sdg.com > wrote in message

news:<nR******* *************@t wister.tampabay .rr.com>...
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.exec uteQuery("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
1701
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
1656
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 for MySQL. /T --
0
3326
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 below suggests that this problem might now be fixed by Borland. Best regards, Heikki Tuuri
0
588
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 example that worked under postgresql and does not using mysql: aStatement.executeQuery("BEGIN; DELETE FROM table1; DELETE FROM table1; DELETE FROM table3; COMMIT;");
5
2048
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 have read the manual ana I thought I knew how to do it. I set the tables type to InnoDB (i can't use BDB) and change the default mysqld.exe to mysql-max (or mysql-max-nt). I even used : SET AUTOCOMMIT=0. I'm doing more less this: 1. START...
2
3817
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 breaking point. The application is a typical web application w/ 2 web servers running Apache/Tomcat connecting to a dedicated DB server running only MySQL. This seems to occur as a result of running many statements in a single transaction, both...
0
1254
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 happens if for instance 2 different users tries to modify same data in 2 different transactions in 2 different connections ? does the last one which finish simply "win" (erasing the other's work) or does mysql is able to lock rows in a correct way...
9
4805
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 .= 'SET position=position-%d ';
14
9032
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 procedures 2) through transactions Of course i am going to prefer is the 2 way i.e. transactions. I went thru all the manuals of which Ronald gave me the links. But reading many forums and tutorials, i land up here again just to know why my code...
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9370
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8242
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.