Fala pessoas, tudo bom?
Tenho um aplicação rodando em Derby e gostaria de migrar pro MySQL.
Coloquei a URL, login e senha, etc. Banco está instalado, criei o usuário e o banco ‘scadabr’, essas coisas…
Entretanto, como eu faço pra migrar o meu layout e essas coisas?
Vi que possui uns campos marcados como convert no .env.properties…
convert.db_type
convert.db_user
etc.
1 curtida
Realizei a migração parcialmente.
Adicionei o banco derby ao convert.db..
Adicionei o banco mysql ao db.
Reiniciei a aplicação e vejo que alguns dados estão sendo migrados pelos logs.
Entretanto, alguns erros acontecem sem me dizer ao certo o que está acontecendo (ou talvez eu não esteja conseguindo entender).
Segue o log:
com.serotonin.ShouldNeverHappenException: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`scadabr`.`reportinstancedata`, CONSTRAINT `reportInstanceDataFk1` FOREIGN KEY (`reportInstancePointId`) REFERENCES `reportinstancepoints` (`id`) ON DELETE CASCADE)
at com.serotonin.mango.db.DatabaseAccess.initialize(DatabaseAccess.java:125)
at com.serotonin.mango.MangoContextListener.databaseInitialize(MangoContextListener.java:372)
at com.serotonin.mango.MangoContextListener.contextInitialized(MangoContextListener.java:101)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`scadabr`.`reportinstancedata`, CONSTRAINT `reportInstanceDataFk1` FOREIGN KEY (`reportInstancePointId`) REFERENCES `reportinstancepoints` (`id`) ON DELETE CASCADE)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2554)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1761)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2046)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1964)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1949)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:108)
at com.serotonin.mango.db.DBConvert.copyTable(DBConvert.java:138)
at com.serotonin.mango.db.DBConvert.execute(DBConvert.java:58)
at com.serotonin.mango.db.DatabaseAccess.initialize(DatabaseAccess.java:122)
... 26 more
02/07/2019 18:08:08 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext