Connecting to database failed

User f006038a17

19-10-2015 12:34:24

Hi,


I have tried to connect to my Instant J Chem database (15.10.12.0), but I have a message indicating that connecting failed?


It worked perfectly last friday.... 


Here is the error message :


ERROR 23505: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'PK_IJC_AUTHS' defined on 'IJC_AUTHORITIES'.


at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)


at org.apache.derby.impl.sql.execute.IndexChanger.insertAndCheckDups(Unknown Source)


at org.apache.derby.impl.sql.execute.IndexChanger.doInsert(Unknown Source)


at org.apache.derby.impl.sql.execute.IndexChanger.insert(Unknown Source)


at org.apache.derby.impl.sql.execute.IndexSetChanger.insert(Unknown Source)


at org.apache.derby.impl.sql.execute.RowChangerImpl.insertRow(Unknown Source)


at org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(Unknown Source)


at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown Source)


at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)


at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)


Caused: java.sql.SQLException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'PK_IJC_AUTHS' defined on 'IJC_AUTHORITIES'.


at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)


at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)


Caused: java.sql.SQLIntegrityConstraintViolationException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'PK_IJC_AUTHS' defined on 'IJC_AUTHORITIES'.


at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)


at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)


at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)


at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)


at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)


at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)


at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)


at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source)


at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown Source)


at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown Source)


at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)


at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)


at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)


at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:824)


at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:818)


at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:589)


Caused: org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [INSERT INTO IJC_AUTHORITIES (AUTHORITY,DESCRIPTION, RANK) VALUES (?, ?, ?)]; The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'PK_IJC_AUTHS' defined on 'IJC_AUTHORITIES'.; nested exception is java.sql.SQLIntegrityConstraintViolationException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'PK_IJC_AUTHS' defined on 'IJC_AUTHORITIES'.


at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:245)


at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)


at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:605)


at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:818)


at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:874)


at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:878)


at com.chemaxon.ijc.db.dao.schema.impl.IjcMetadataDaoImpl.addMandatoryRoles(IjcMetadataDaoImpl.java:337)


at com.chemaxon.ijc.db.dao.schema.impl.IjcMetadataDaoImpl.createDatabaseArtifacts(IjcMetadataDaoImpl.java:153)


at com.im.df.impl.db.sprovider.SproviderUtils.readApplicationContext(SproviderUtils.java:181)


at com.im.df.impl.db.sprovider.PropsReadState.proceedToNextState(PropsReadState.java:134)


at com.im.df.impl.db.sprovider.SchemaProviderImpl.proceedToNextState(SchemaProviderImpl.java:131)


[catch] at com.im.ijc.core.api.util.SchemaInitManager.startInit(SchemaInitManager.java:244)


at com.im.ijc.core.api.util.SchemaInitManager.access$300(SchemaInitManager.java:56)


at com.im.ijc.core.api.util.SchemaInitManager$InitTask.run(SchemaInitManager.java:452)


at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1411)


at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1991)


INFO [com.im.ijc.core.api.util.SchemaInitManager]: Schema init failed in 'Connecting to database' with message: Connecting to database failed: 


PreparedStatementCallback; SQL [INSERT INTO IJC_AUTHORITIES (AUTHORITY,DESCRIPTION, RANK) VALUES (?, ?, ?)]; The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'PK_IJC_AUTHS' defined on 'IJC_AUTHORITIES'.; nested exception is java.sql.SQLIntegrityConstraintViolationException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'PK_IJC_AUTHS' defined on 'IJC_AUTHORITIES'.


 


 

ChemAxon 37bb34e128

19-10-2015 17:18:46

Hi, this looks like bug on our end. We will investigate this further and let you know about the fix or if you can work around this problem somehow.


Thanks for reporting this,
-vita

ChemAxon 37bb34e128

25-10-2015 09:09:27

Hi, we are not sure what exactly leads to this error. The insertion of IJC mandatory roles to IJC_AUTHORITIES table seems to work fine in our testing environments and we have not heard any other complaints about this so far.


I added some extra diagnostic logging into IJC that could reveal what is going on. The enhanced logging will be available in 15.10.26.0 release. Could you please try this version and attach here the IJC log file? Also please turn on SQL logging before connecting to your database. You can find this setting in Tools > Options dialog and then go to Miscellaneous > Other settings > SQL logging.


The exception that you posted here shows that you are using a Derby database. I assume that this is an ordinary Derby database created by IJC. Is this assumption correct?


Thanks,
-vita

User f006038a17

02-11-2015 12:39:28

Dear Vita 


As requested, I have switch on the SQL logging, and you will find the file "messages.log.1" in attach 


By the way, it's indeed an ordinary Derby database created by IJC


Thanks

ChemAxon 37bb34e128

09-11-2015 08:16:28

Hi, I am sorry, but I don't see the exception in the log file? Neither I see any SQL statements. Is the exception that you posted here originally still reproducible? If so, could you please:



  1. make sure that SQL logging is on in IJC

  2. reproduce the problem

  3. attach the IJC log file that shows the exception here

  4. describe here the steps that you've take so that I could follow them


Thanks a lot for your help!


-vita