ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robin Johnson <ro...@syndicom.com>
Subject Re: can't insert into InnoDB tables
Date Mon, 06 Dec 2004 01:42:21 GMT
Thanks Kris,
You were right- it was a transaction-related problem.
Setting JDBC.DefaultAutoCommit to true didn't help, but I looked at my 
code again and discovered that it didn't call 
SqlMapClient.commitTransaction() before endTransaction().  Adding a 
commitTransaction() call fixed my problem.

*sigh*, I'm learning....

Thanks again,
Robin

Kris Jenkins wrote:

> Hey Robin,
>
> Your problem is to do with transactions, I believe.  MyISAM tables 
> don't support transactions (a pox on them and all their kind), but 
> InnoDB tables do.  When you insert into a MyISAM table, the data is 
> just written.  With an InnoDB table you have to either commit or 
> rollback the change.  I think that the MySQL driver will rollback by 
> default, hence your problem.  The easiest solution is to try this as a 
> SimpleDataSource property:
>
>    <property name="JDBC.DefaultAutoCommit" value="true" />
>
> But if the distinction between transactional and non-transactional 
> table types doesn't mean much to you, take a look at this:
>
>   http://dev.mysql.com/books/mysqlpress/mysql-tutorial/ch10.html
>
> HTH,
> Kris
>
>


Mime
View raw message