It solves only mistakes durring queries, not automatic rollabks from
concurrently transactions ...
Jiri Chaloupka
<citováno kdo="Emmanuel Eze">
> Why not try this approach:
>
> try
> (
> conn.setAutoCommit(false);
> stmt.execute(.....);
> stmt.execute(.....);
> stmt.exexute(....);
> conn.commit();
> )
> catch (SQLException slqe)
> {
> conn.rollback();
> }
>
> finally
> {
> conn.setAutoCommit(true);
> stmt.close;
> conn.close();
> }
>
> Emma
>
> -----Original Message-----
> From: Jiri Chaloupka [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 25, 2002 9:35 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Off-topic: JSP and MySQL
>
>
> I do not know mySQL well, see manual page, looking for transactions.
> (begin - commit - rollback - if it is supported ...)
>
> boolean doit = true;
> stm.execute("begin");
> stm2.execute("begin");
> stm3.exexute("begin");
> if(!stm.execute("insert into ...")){
> doit = false;
> }
> if(!stm2.execute("insert into ...")){
> doit = false;
> }
> if(!stm3.execute("insert into ...")){
> doit = false;
> }
> if(doit){
> stm.execute("commit");
> stm2.execute("commit");
> stm3.execute("commit");
> }else{
> stm.execute("rollback");
> stm2.execute("rollback");
> stm3.execute("rollback");
> }
>
> Jiri Chaloupka
>
--
Jiri Chaloupka
B2BExpander.com
[EMAIL PROTECTED]
**********************************************
http://www.b2bexpander.com/
http://www,chalu.cz
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com