> if (connection.isAutoCommitSupported()) {
I wonder if SQLite JDBC is improperly saying that auto-commit is not supported. Can you debug down to there to see if it works Nick.
gray
Most certainly. I have it in my todo queue, I'll let you know as soon
as I'm able to get it debugged. Hopefully in the next 4-6 hours.
>
> gray
>
I debugged down the stack and I figured out the issue. I stepped
through the code and could see that connection.isAutoCommitSupported()
was returning true and that setAutoCommit was being called with 'false'.
Still the commits were happening on every insert.
The real problem seems to stem from the fact that I was using
JdbcPooledConnectionSource. I have to admit my lack of expertise on the
matter, but I assumed pooling the jdbc connections for 35k inserts would
be good. I really probably shouldn't have started there but, early
optimization is one of my short comings :)
Anyway, it seems that callBatchTasks only effects one connection. When
I got into the actual commit logic, I could see that I was getting a
different connection source for the creates then i got when i called
callBatchTasks. It seems as though there is some state information
missing from BaseDaoImpl when callBatchTasks is called to ensure that
all connection sources that are created also have auto-commit turned
off. I'm not sure of the best way to implement this or if this is a
true issue.
Thanks,
Nick
On Thu, 2011-02-03 at 11:08 -0500, Gray Watson wrote:
> Anyway, it seems that callBatchTasks only effects one connection. When
> I got into the actual commit logic, I could see that I was getting a
> different connection source for the creates then i got when i called
> callBatchTasks.
Oh boy. That as a bug dude. Just fixed this in the main line and it will be in 4.11. A real miss for sure. I assed a saveSpecialConnection() call to the callBatchTasks() which will mean that every time you get a connection inside of the callable, it will be the same connection that has been auto-committed.
Here's the new copy of the BaseDaoImpl.callBatchTasks():
public <CT> CT callBatchTasks(Callable<CT> callable) throws Exception {
checkForInitialized();
DatabaseConnection connection = connectionSource.getReadWriteConnection();
try {
// new line
connectionSource.saveSpecialConnection(connection);
return statementExecutor.callBatchTasks(connection, callable);
} finally {
// new line
connectionSource.clearSpecialConnection(connection);
connectionSource.releaseConnection(connection);
}
}
Sorry about that.
gray
https://sourceforge.net/tracker/?func=detail&aid=3178539&group_id=297653&atid=1255989
gray