18 messages in com.mysql.lists.javaRe: Multiple line request| From | Sent On | Attachments |
|---|---|---|
| Andrei Vodeniktov | 20 Aug 2002 10:27 | |
| Mark Matthews | 20 Aug 2002 17:02 | |
| Andrei Vodeniktov | 20 Aug 2002 17:56 | |
| Joaquin Fernandez | 20 Aug 2002 23:34 | |
| Mark Matthews | 21 Aug 2002 04:28 | |
| Andrei Vodeniktov | 21 Aug 2002 12:46 | |
| Mark Matthews | 26 Aug 2002 04:37 | |
| Andrei Vodeniktov | 26 Aug 2002 14:59 | |
| Mark Matthews | 26 Aug 2002 16:09 | |
| Andrei Vodeniktov | 26 Aug 2002 17:05 | |
| Udkik | 27 Aug 2002 00:16 | |
| priyank | 27 Aug 2002 00:42 | |
| Udkik | 27 Aug 2002 03:02 | |
| Mark Matthews | 27 Aug 2002 04:51 | |
| Udkik | 27 Aug 2002 06:26 | |
| Udkik | 27 Aug 2002 13:14 | |
| Udkik | 30 Aug 2002 04:13 | |
| Mark Matthews | 30 Aug 2002 07:31 |
| Subject: | Re: Multiple line request![]() |
|---|---|
| From: | Andrei Vodeniktov (avo...@netscape.com) |
| Date: | 08/26/2002 02:59:14 PM |
| List: | com.mysql.lists.java |
Joaquin, thanks for good idea!
I wrote little parser that scans SQL statement for "/n", breaks it into multiple
lines and
then builds batch request. Works like a clock and I didnt have to change all my
code in
multiple places. :)
Andrei
----- Original Message ----- From: "Joaquin Fernandez" <joaq...@fgadf.com> To: "Andrei Vodeniktov" <avo...@netscape.com> Cc: <ja...@lists.mysql.com> Sent: Tuesday, August 20, 2002 11:35 PM Subject: RE: Multiple line request
As far as i know, you can place multiple inserts or updates in a unique call. But all statements must be for the same table, i.e.:
String query = "INSERT INTO ... (....) VALUES (...)" PreparedStatement st = conn.prepareStatement(query);
while (moreInserts) { st.setString(1, ...); ... ...
st.addBatch(); }
int[] status = st.executeBatch();
Hope this can help you
Regards
Joaquin
-----Mensaje original----- De: Andrei Vodeniktov [mailto:avo...@netscape.com] Enviado el: miércoles, 21 de agosto de 2002 2:57 Para: Mark Matthews CC: ja...@lists.mysql.com Asunto: Re: Multiple line request
Mark, thank you for reply. Is there any trick to place multiple insert statements inside single function call in Java? I need to create 2 rows in 2 tables.
Thank you. Andrei
----- Original Message ----- From: "Mark Matthews" <mmat...@thematthews.org> To: "Andrei Vodeniktov" <avo...@netscape.com> Cc: <ja...@lists.mysql.com> Sent: Tuesday, August 20, 2002 5:03 PM Subject: Re: Multiple line request
Andrei Vodeniktov wrote:
How do I separate multiple statements in single request
string? I tried to use ';' but I
got SQLException back complaining about ';'. Im using 3.23 release.
Thanks a lot. Andrei
--------------------------------------------------------------------- Please check
"http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail java...@lists.mysql.com
To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail java...@lists.mysql.com instead.
MySQL does not support this construct. The ";" only means anything to the mysql command-line client, which uses it as an end-of-statement token.
-Mark
--------------------------------------------------------------------- Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before posting. To request this thread, e-mail java...@lists.mysql.com
To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail java...@lists.mysql.com instead.




