ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jerome Gagner" <phpmon...@gmail.com>
Subject Re: Transaction Ibati MySql don't work
Date Tue, 23 May 2006 23:25:51 GMT
http://dev.mysql.com/doc/refman/5.0/en/innodb-monitor.html

On 5/23/06, Eric T. Blue <ericblue76@gmail.com> wrote:
> Hi,
>
> Sorry if this might be adding to debugging confusion, but by coincidence I'm
> trying to track down this exact problem myself this afternoon.
>
> Java 1.5.0
> MySQL 5.0.18-nt with InnoDB tables
> Ibatis 2.1.5   582 with sqlmaps and dao, JDBC.DefaultAutoCommit = False
> JDBC MySQL Connector  = 3.0.16 ga
>
> I'm wrapping my code with a transaction, can verify that an exception is
> thrown and commitTransaction() is never called, however the insert was
> committed.  This may or may not be related to Gary's problem, however I
> wanted to throw this out there in case it is.  I'm going to debug further on
> my end in case there is something very obvious I'm missing.
>
> I have my logger set to DEBUG for java.sql.ResultSet and
> java.sql.PreparedStatement, and I can see the insert statement happening.
> Any pointers on how I can detect when commit or rollback statements are
> executed?
>
> ---------- Forwarded message ----------
> From: Jerome Gagner < phpmonkey@gmail.com>
> Date: May 23, 2006 7:58 AM
> Subject: Re: Transaction Ibati MySql don't work
> To: user-java@ibatis.apache.org
>
>
>  As larry said, make sure the tables are InnoDB, easy one to miss.
> MySQL happily plugs along w/ MyISAM pretending like it does
> transactions.
>
> On 5/23/06, Niels Beekman <n.beekman@wis.nl> wrote:
> > You specified SetAutoCommitAllowed="false", that instructs iBATIS to leave
> the default autocommit setting (true) in place, which causes automatic
> commits, unless an SQLException occurs when executing a statement. Changing
> it to "true" will cause iBATIS to use the "DefaultAutoCommit" setting.
> >
> > Niels
> >
> > -----Original Message-----
> > From: Gary Efraín Laredo Chacón [mailto: laredo.ge@pucp.edu.pe]
> > Sent: dinsdag 23 mei 2006 16:05
>  > To: brandon.goodin@gmail.com
> > Cc: user-java@ibatis.apache.org
> > Subject: Re: Transaction Ibati MySql don't work
> >
> >
> >
> > Thanks,
> >
> > Exactly I want that it does roollbak, but it does not do it, the changes
> get to
> > persist, without commit.
> >
> > thanks very much
> >
> > ------ Mensaje original -------
> > De : brandon.goodin@gmail.com
> > Para : user-java@ibatis.apache.org
> > Fecha : Tue, 23 May 2006 07:35:04 -0500
> > Asunto : Re: Transaction Ibati MySql don\'t work
> > >Precisely,
> > >
> > >That is why i wanted to see the real code that was being called. The
> > >piece that i saw looked more like a sample than real code. The
> > >endTransaction without a commitTransaction will perform a rollback.
> > >iBATIS does not have an explicit rollback call. Basically, if you call
> > >startTransaction and then endTransaction without a commitTransaction,
> > >it is assumed that there was a problem and the rollback is performed.
> > >
> > >Thanks for the feedback Ed !
> > >
> > >Brandon Goodin
> > >
> > >On 5/23/06, mrEdmundo < mrEdmundo@uko2.co.uk> wrote:
> > >> Hi,
> > >>
> > >> It\'s a bit difficult to tell from the code sample you\'ve provided,
> but are
> > >> you calling sqlMap.commitTransaction(); at the end of your updates?
> > >>
> > >> Your code should be:
> > >>
> > >> try
> > >> {
> > >>     sqlMap.startTransaction();
> > >>
> > >>     // do your updates
> > >>
> > >>     sqlMap.commitTransaction();
> > >> }
> > >> finally
> > >> {
> > >>     sqlMap.endTransaction(); // will rollback if transaction not
> committed
> > >> }
> > >>
> > >> Regards, Ed.
> > >>
> > >> -----Original Message-----
> > >> From: Gary Efraín Laredo Chacón [mailto: laredo.ge@pucp.edu.pe]
> > >> Sent: 23 May 2006 06:09
> > >> To: brandon.goodin@gmail.com
> > >> Cc: user-java@ibatis.apache.org
> > >> Subject: Re: Transaction Ibati MySql don\'t work
> > >>
> > >>
> > >>
> > >> Thanks,
> > >>
> > >> The sqlMapConfig.xml file is:
> > >>
> > >> <?xml version=\"1.0\" encoding=\"UTF-8\"?> <!DOCTYPE sqlMapConfig
> PUBLIC
> > >> \"-//ibatis.apache.org//DTD SQL Map Config 2.0//EN\"
> > >> \"http://ibatis.apache.org/dtd/sql-map-config-2.dtd\">
> > >> <sqlMapConfig>
> > >>   <settings lazyLoadingEnabled=\"true\" cacheModelsEnabled=\"true\"
> > >> enhancementEnabled=\"true\" maxRequests=\"32\"   maxSessions=\"10\"
> > >> maxTransactions=\"5\"
> useStatementNamespaces=\"false\"/>
> > >>   <transactionManager commitRequired=\"true\" type=\"JDBC\">
> > >>     <property name=\"SetAutoCommitAllowed\" value=\"false\"/>
> > >>     <property name=\"DefaultAutoCommit\" value=\"false\"/>
> > >>   <dataSource type=\"SIMPLE\">
> > >>     <property name=\"JDBC.Driver\" value=\"org.gjt.mm.mysql.Driver\"/>
> > >>     <property name=\"JDBC.ConnectionURL\"
> > >> value=\"jdbc:mysql://hosting:3306/database\"/>
> > >>     <property name=\"JDBC.Username\" value=\"usuario\"/>
> > >>     <property name=\"JDBC.Password\" value=\"clave\"/>
> > >>     <property name=\" Pool.PingQuery\" value=\"select @@VERSION\"/>
> > >>     <property name=\"Pool.MaximumActiveConnections\" value=\"10\"/>
> > >>     <property name=\" Pool.MaximumIdleConnections\" value=\"5\"/>
> > >>     <property name=\"Pool.MaximumWait\" value=\"1000\"/>
> > >>     <property name=\"Pool.QuietMode\ " value=\"false\"/>
> > >>   </dataSource>
> > >>   </transactionManager>
> > >>   <sqlMap resource=\"maps/Cliente.xml\"/>
> > >>   <sqlMap resource=\"maps/Parametro.xml\"/>
> </sqlMapConfig>
> > >>
> > >> Please help me
> > >>
> > >>
> > >> ------ Mensaje original -------
> > >> De : brandon.goodin@gmail.com
> > >> Para : user-java@ibatis.apache.org, laredo.ge@pucp.edu.pe Fecha : Mon,
> 22
> > >> May 2006 20:30:03 -0500 Asunto : Re: Transaction Ibati MySql don\'t
> work
> > >> >Please provide how you have proven that the transactions are not
> > >> >working. Also, like Jerome stated, please post all configs and actual
> > >> >java code involved when asking for support.
> > >> >
> > >> >Thanks,
> > >> >Brandon
> > >> >
> > >> >On 5/22/06, Gary Efraín Laredo Chacón < laredo.ge@pucp.edu.pe
> wrote:
> > >> >>
> > >> >>
> > >> >>
> > >> >> Please help me
> > >> >>
> > >> >> I am used jdk1.5 + MySql 4.1.x + Ibatis 2.0 + JConnector 3.1.12
> > >> >> (3.1.8a) and don\'t work transactions (allways commit for each
> > >> >> statement), my MySql database is a hosting on the other place,
> sample of
> > >> code:
> > >> >>
> > >> >> ClienteBean cliente = new ClienteBean(); Reader reader1 =
> > >> >>
> Resources.getResourceAsReader(\\\"maps/sqlMapConfig.xml\\\");
> > >> >> SqlMapClient sqlMap =
> SqlMapClientBuilder.buildSqlMapClient(reader1);
> > >> >>
> > >> >> sqlMap.startTransaction();
> > >> >>
> sqlMap.update(\\\"updateCorrelativo\\\",\\\"000\\\");
> //update table
> > >> >> here allways sqlMap.endTransaction();//but It coult be rollbak
> > >> >>
> > >> >>
> > >> >>
> > >> >>
> > >> >>
>  > >> >>
> ___________________________________________________________________
> > >> >> Si desea recibir, semanalmente, el Boletín Electrónico de la
PUCP,
> > >> ingrese a:
> > >> >> http://www.pucp.edu.pe/boletin/
> > >> >>
> > >> >>
> > >> >
> > >>
> > >>
> > >>
> ___________________________________________________________________
> > >> Si desea recibir, semanalmente, el Boletín Electrónico de la PUCP,
> ingrese
> > >> a:
> > >> http://www.pucp.edu.pe/boletin/
> > >>
> > >>
> > >
> >
> >
> >
> ___________________________________________________________________
> > Si desea recibir, semanalmente, el Boletín Electrónico de la PUCP, ingrese
> a:
> > http://www.pucp.edu.pe/boletin/
> >
> >
>

Mime
View raw message