Hi Marco,

I think what you need is a reconnect parameter in your MySQL URL. E.g.:

   jdbc:mysql://localhost/test?autoReconnect=true

Andrus


On Jan 8, 2008, at 8:02 PM, marco turchi wrote:

Dear experts,
I'm running a java software that gets some data from the DB, computes them and the writes the result to the DB... Unfortunately, the computation of the
data gets 10 hs...
I'm able to get the data, compute them, but when I try to write to the DB, I
get this error:
org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2.3 May 6 2007] Commit
Exception
       at org.objectstyle.cayenne.access.DataContext.flushToParent(
DataContext.java:1290)
       at org.objectstyle.cayenne.access.DataContext.commitChanges (
DataContext.java:1166)
       at com.translation.alg.WriterData.insert(WriterData.java:57)
       at com.translation.alg.News.write(News.java:85)
at com.translation.alg.TranslationNews.run(TranslationNews.java :66) at com.translation.alg.TranslationNews.main(TranslationNews.java:21)
Caused by: java.sql.SQLException: Connection.close() has already been
called. Invalid operation in this state.
       at com.mysql.jdbc.Connection.getMutex (Connection.java:2130)
       at com.mysql.jdbc.Statement.execute(Statement.java:866)
at org.objectstyle.cayenne.dba.mysql.MySQLPkGenerator.pkFromDatabase
(MySQLPkGenerator.java:123)
at org.objectstyle.cayenne.dba.JdbcPkGenerator.generatePkForDbEntity(
JdbcPkGenerator.java:326)
       at
org .objectstyle .cayenne.access.DataDomainInsertBucket.createPermIdsForObjEntity
(DataDomainInsertBucket.java:194)
       at
org .objectstyle .cayenne.access.DataDomainInsertBucket.appendQueriesInternal(
DataDomainInsertBucket.java:122)
at org.objectstyle.cayenne.access.DataDomainSyncBucket.appendQueries
(DataDomainSyncBucket.java:108)
at org.objectstyle.cayenne.access.DataDomainFlushAction.preprocess (
DataDomainFlushAction.java:211)
       at org.objectstyle.cayenne.access.DataDomainFlushAction.flush(
DataDomainFlushAction.java:167)
       at org.objectstyle.cayenne.access.DataDomain.onSyncFlush(
DataDomain.java :846)
       at org.objectstyle.cayenne.access.DataDomain$2.transform(
DataDomain.java:817)
       at org.objectstyle.cayenne.access.DataDomain.runInTransaction(
DataDomain.java:862)
at org.objectstyle.cayenne.access.DataDomain.onSync (DataDomain.java
:814)
       at org.objectstyle.cayenne.access.DataContext.flushToParent(
DataContext.java:1262)
       ... 5 more

I have tried to delete and recreate the DataContext using
createDataContext() before to write to the table, but I get the same error. (I have created the DataContext the first time when I start the program...)
Can u help me?
Thanks a lot
Marco

Reply via email to