Cordapp with accounts enable cannot connect to sql server. I tried with version 2017, 2019 and Azure SQL. Almost in all versions I get the same error:
The runMigration flag is already set to true in build config. I am getting this error while starting the nodes.
Since the error points to the account_to_state_refs table and that is created internally by corda, I am not sure to fix it in the cordapp side.
[ERROR] 2020-03-19T14:18:41,156Z [main] internal.NodeStartupLogging. - Exception during node startup: Incompatible schema change detected.
Please run the node with database.initialiseSchema=true. Reason: Schema-validation: wrong column type encountered in column [external_id] in table
[partya_schema.account_to_state_refs]; found [uniqueidentifier (Types#CHAR)], but expecting [binary(255) (Types#BINARY)] [errorCode=bdopq4, moreInformationAt=https://errors.corda.net/ENT/4.3/bdopq4] {}
net.corda.nodeapi.internal.persistence.HibernateSchemaChangeException: Incompatible schema change detected. Please run the node with database.initialiseSchema=true. Reason: Schema-validation: wrong column type encountered in column [external_id] in table [partya_schema.account_to_state_refs]; found [uniqueidentifier (Types#CHAR)], but expecting [binary(255) (Types#BINARY)]
at net.corda.nodeapi.internal.persistence.CordaPersistence$hibernateConfig$2$1.invoke(CordaPersistence.kt:121) ~[corda-node-api-4.3.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence$hibernateConfig$2$1.invoke(CordaPersistence.kt:101) ~[corda-node-api-4.3.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:248) ~[corda-node-api-4.3.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:227) ~[corda-node-api-4.3.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:233) ~[corda-node-api-4.3.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence$hibernateConfig$2.invoke(CordaPersistence.kt:116) ~[corda-node-api-4.3.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence$hibernateConfig$2.invoke(CordaPersistence.kt:101) ~[corda-node-api-4.3.jar:?]
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) ~[kotlin-stdlib-1.2.71.jar:1.2.71-release-64 (1.2.71)]
at net.corda.nodeapi.internal.persistence.CordaPersistence.getHibernateConfig(CordaPersistence.kt) ~[corda-node-api-4.3.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence.getEntityManagerFactory(CordaPersistence.kt:128) ~[corda-node-api-4.3.jar:?]
at net.corda.nodeapi.internal.persistence.DatabaseTransaction$sessionDelegate$1.invoke(DatabaseTransaction.kt:41) ~[corda-node-api-4.3.jar:?]
at net.corda.nodeapi.internal.persistence.DatabaseTransaction$sessionDelegate$1.invoke(DatabaseTransaction.kt:21) ~[corda-node-api-4.3.jar:?]
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) ~[kotlin-stdlib-1.2.71.jar:1.2.71-release-64 (1.2.71)]
at net.corda.nodeapi.internal.persistence.DatabaseTransaction.getSession(DatabaseTransaction.kt) ~[corda-node-api-4.3.jar:?]
at net.corda.node.services.network.PersistentNetworkMapCache$getNodesByLegalName$1.invoke(PersistentNetworkMapCache.kt:125) ~[corda-node-4.3.jar:?]
at net.corda.node.services.network.PersistentNetworkMapCache$getNodesByLegalName$1.invoke(PersistentNetworkMapCache.kt:41) ~[corda-node-4.3.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:248) ~[corda-node-api-4.3.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:227) ~[corda-node-api-4.3.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:233) ~[corda-node-api-4.3.jar:?]
at net.corda.node.services.network.PersistentNetworkMapCache.getNodesByLegalName(PersistentNetworkMapCache.kt:125) ~[corda-node-4.3.jar:?]
at net.corda.node.internal.AbstractNode.getPreviousNodeInfoIfPresent(AbstractNode.kt:638) ~[corda-node-4.3.jar:?]
at net.corda.node.internal.AbstractNode.updateNodeInfo(AbstractNode.kt:606) ~[corda-node-4.3.jar:?]
at net.corda.node.internal.AbstractNode.access$updateNodeInfo(AbstractNode.kt:208) ~[corda-node-4.3.jar:?]
at net.corda.node.internal.AbstractNode$start$6.invoke(AbstractNode.kt:468) ~[corda-node-4.3.jar:?]
at net.corda.node.internal.AbstractNode$start$6.invoke(AbstractNode.kt:208) ~[corda-node-4.3.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence.inTopLevelTransaction(CordaPersistence.kt:281) ~[corda-node-api-4.3.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:250) ~[corda-node-api-4.3.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:227) ~[corda-node-api-4.3.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:233) ~[corda-node-api-4.3.jar:?]
at net.corda.node.internal.AbstractNode.start(AbstractNode.kt:467) ~[corda-node-4.3.jar:?]
at net.corda.node.internal.Node.start(Node.kt:552) ~[corda-node-4.3.jar:?]
at net.corda.node.internal.EnterpriseNode.start(EnterpriseNode.kt:210) ~[corda-node-4.3.jar:?]
at net.corda.node.internal.NodeStartup.startNode(NodeStartup.kt:211) ~[corda-node-4.3.jar:?]
at net.corda.node.internal.NodeStartupCli$runProgram$2.run(NodeStartup.kt:132) ~[corda-node-4.3.jar:?]
at net.corda.node.internal.NodeStartup$initialiseAndRun$5.invoke(NodeStartup.kt:188) ~[corda-node-4.3.jar:?]
at net.corda.node.internal.NodeStartup$initialiseAndRun$5.invoke(NodeStartup.kt:139) ~[corda-node-4.3.jar:?]
at net.corda.node.internal.NodeStartupLogging$DefaultImpls.attempt(NodeStartup.kt:538) ~[corda-node-4.3.jar:?]
at net.corda.node.internal.NodeStartup.attempt(NodeStartup.kt:139) ~[corda-node-4.3.jar:?]
at net.corda.node.internal.NodeStartup.initialiseAndRun(NodeStartup.kt:187) ~[corda-node-4.3.jar:?]
at net.corda.node.internal.NodeStartupCli.runProgram(NodeStartup.kt:130) ~[corda-node-4.3.jar:?]
at net.corda.cliutils.CordaCliWrapper.call(CordaCliWrapper.kt:190) ~[corda-tools-cliutils-4.3.jar:?]
at net.corda.node.internal.NodeStartupCli.call(NodeStartup.kt:85) ~[corda-node-4.3.jar:?]
at net.corda.node.internal.NodeStartupCli.call(NodeStartup.kt:66) ~[corda-node-4.3.jar:?]
at picocli.CommandLine.execute(CommandLine.java:1173) ~[picocli-3.9.6.jar:3.9.6]
at picocli.CommandLine.access$800(CommandLine.java:141) ~[picocli-3.9.6.jar:3.9.6]
at picocli.CommandLine$RunLast.handle(CommandLine.java:1367) ~[picocli-3.9.6.jar:3.9.6]
at picocli.CommandLine$RunLast.handle(CommandLine.java:1335) ~[picocli-3.9.6.jar:3.9.6]
at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:1243) ~[picocli-3.9.6.jar:3.9.6]
at picocli.CommandLine.parseWithHandlers(CommandLine.java:1526) ~[picocli-3.9.6.jar:3.9.6]
at net.corda.cliutils.CordaCliWrapperKt.start(CordaCliWrapper.kt:73) ~[corda-tools-cliutils-4.3.jar:?]
at net.corda.node.Corda.main(Corda.kt:13) ~[corda-node-4.3.jar:?]
Cordapp with accounts enable cannot connect to sql server. I tried with version 2017, 2019 and Azure SQL. Almost in all versions I get the same error: The runMigration flag is already set to true in build config. I am getting this error while starting the nodes.
Since the error points to the account_to_state_refs table and that is created internally by corda, I am not sure to fix it in the cordapp side.
[ERROR] 2020-03-19T14:18:41,156Z [main] internal.NodeStartupLogging. - Exception during node startup: Incompatible schema change detected. Please run the node with database.initialiseSchema=true. Reason: Schema-validation: wrong column type encountered in column [external_id] in table [partya_schema.account_to_state_refs]; found [uniqueidentifier (Types#CHAR)], but expecting [binary(255) (Types#BINARY)] [errorCode=bdopq4, moreInformationAt=https://errors.corda.net/ENT/4.3/bdopq4] {} net.corda.nodeapi.internal.persistence.HibernateSchemaChangeException: Incompatible schema change detected. Please run the node with database.initialiseSchema=true. Reason: Schema-validation: wrong column type encountered in column [external_id] in table [partya_schema.account_to_state_refs]; found [uniqueidentifier (Types#CHAR)], but expecting [binary(255) (Types#BINARY)] at net.corda.nodeapi.internal.persistence.CordaPersistence$hibernateConfig$2$1.invoke(CordaPersistence.kt:121) ~[corda-node-api-4.3.jar:?] at net.corda.nodeapi.internal.persistence.CordaPersistence$hibernateConfig$2$1.invoke(CordaPersistence.kt:101) ~[corda-node-api-4.3.jar:?] at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:248) ~[corda-node-api-4.3.jar:?] at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:227) ~[corda-node-api-4.3.jar:?] at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:233) ~[corda-node-api-4.3.jar:?] at net.corda.nodeapi.internal.persistence.CordaPersistence$hibernateConfig$2.invoke(CordaPersistence.kt:116) ~[corda-node-api-4.3.jar:?] at net.corda.nodeapi.internal.persistence.CordaPersistence$hibernateConfig$2.invoke(CordaPersistence.kt:101) ~[corda-node-api-4.3.jar:?] at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) ~[kotlin-stdlib-1.2.71.jar:1.2.71-release-64 (1.2.71)] at net.corda.nodeapi.internal.persistence.CordaPersistence.getHibernateConfig(CordaPersistence.kt) ~[corda-node-api-4.3.jar:?] at net.corda.nodeapi.internal.persistence.CordaPersistence.getEntityManagerFactory(CordaPersistence.kt:128) ~[corda-node-api-4.3.jar:?] at net.corda.nodeapi.internal.persistence.DatabaseTransaction$sessionDelegate$1.invoke(DatabaseTransaction.kt:41) ~[corda-node-api-4.3.jar:?] at net.corda.nodeapi.internal.persistence.DatabaseTransaction$sessionDelegate$1.invoke(DatabaseTransaction.kt:21) ~[corda-node-api-4.3.jar:?] at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) ~[kotlin-stdlib-1.2.71.jar:1.2.71-release-64 (1.2.71)] at net.corda.nodeapi.internal.persistence.DatabaseTransaction.getSession(DatabaseTransaction.kt) ~[corda-node-api-4.3.jar:?] at net.corda.node.services.network.PersistentNetworkMapCache$getNodesByLegalName$1.invoke(PersistentNetworkMapCache.kt:125) ~[corda-node-4.3.jar:?] at net.corda.node.services.network.PersistentNetworkMapCache$getNodesByLegalName$1.invoke(PersistentNetworkMapCache.kt:41) ~[corda-node-4.3.jar:?] at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:248) ~[corda-node-api-4.3.jar:?] at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:227) ~[corda-node-api-4.3.jar:?] at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:233) ~[corda-node-api-4.3.jar:?] at net.corda.node.services.network.PersistentNetworkMapCache.getNodesByLegalName(PersistentNetworkMapCache.kt:125) ~[corda-node-4.3.jar:?] at net.corda.node.internal.AbstractNode.getPreviousNodeInfoIfPresent(AbstractNode.kt:638) ~[corda-node-4.3.jar:?] at net.corda.node.internal.AbstractNode.updateNodeInfo(AbstractNode.kt:606) ~[corda-node-4.3.jar:?] at net.corda.node.internal.AbstractNode.access$updateNodeInfo(AbstractNode.kt:208) ~[corda-node-4.3.jar:?] at net.corda.node.internal.AbstractNode$start$6.invoke(AbstractNode.kt:468) ~[corda-node-4.3.jar:?] at net.corda.node.internal.AbstractNode$start$6.invoke(AbstractNode.kt:208) ~[corda-node-4.3.jar:?] at net.corda.nodeapi.internal.persistence.CordaPersistence.inTopLevelTransaction(CordaPersistence.kt:281) ~[corda-node-api-4.3.jar:?] at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:250) ~[corda-node-api-4.3.jar:?] at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:227) ~[corda-node-api-4.3.jar:?] at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:233) ~[corda-node-api-4.3.jar:?] at net.corda.node.internal.AbstractNode.start(AbstractNode.kt:467) ~[corda-node-4.3.jar:?] at net.corda.node.internal.Node.start(Node.kt:552) ~[corda-node-4.3.jar:?] at net.corda.node.internal.EnterpriseNode.start(EnterpriseNode.kt:210) ~[corda-node-4.3.jar:?] at net.corda.node.internal.NodeStartup.startNode(NodeStartup.kt:211) ~[corda-node-4.3.jar:?] at net.corda.node.internal.NodeStartupCli$runProgram$2.run(NodeStartup.kt:132) ~[corda-node-4.3.jar:?] at net.corda.node.internal.NodeStartup$initialiseAndRun$5.invoke(NodeStartup.kt:188) ~[corda-node-4.3.jar:?] at net.corda.node.internal.NodeStartup$initialiseAndRun$5.invoke(NodeStartup.kt:139) ~[corda-node-4.3.jar:?] at net.corda.node.internal.NodeStartupLogging$DefaultImpls.attempt(NodeStartup.kt:538) ~[corda-node-4.3.jar:?] at net.corda.node.internal.NodeStartup.attempt(NodeStartup.kt:139) ~[corda-node-4.3.jar:?] at net.corda.node.internal.NodeStartup.initialiseAndRun(NodeStartup.kt:187) ~[corda-node-4.3.jar:?] at net.corda.node.internal.NodeStartupCli.runProgram(NodeStartup.kt:130) ~[corda-node-4.3.jar:?] at net.corda.cliutils.CordaCliWrapper.call(CordaCliWrapper.kt:190) ~[corda-tools-cliutils-4.3.jar:?] at net.corda.node.internal.NodeStartupCli.call(NodeStartup.kt:85) ~[corda-node-4.3.jar:?] at net.corda.node.internal.NodeStartupCli.call(NodeStartup.kt:66) ~[corda-node-4.3.jar:?] at picocli.CommandLine.execute(CommandLine.java:1173) ~[picocli-3.9.6.jar:3.9.6] at picocli.CommandLine.access$800(CommandLine.java:141) ~[picocli-3.9.6.jar:3.9.6] at picocli.CommandLine$RunLast.handle(CommandLine.java:1367) ~[picocli-3.9.6.jar:3.9.6] at picocli.CommandLine$RunLast.handle(CommandLine.java:1335) ~[picocli-3.9.6.jar:3.9.6] at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:1243) ~[picocli-3.9.6.jar:3.9.6] at picocli.CommandLine.parseWithHandlers(CommandLine.java:1526) ~[picocli-3.9.6.jar:3.9.6] at net.corda.cliutils.CordaCliWrapperKt.start(CordaCliWrapper.kt:73) ~[corda-tools-cliutils-4.3.jar:?] at net.corda.node.Corda.main(Corda.kt:13) ~[corda-node-4.3.jar:?]