You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by afr0ck <af...@gmail.com> on 2018/05/02 20:31:10 UTC

Migrate from MariaDB to Derby using DdlUtils : Ant task failure

Hello,

So i had to convert my production DB from MariaDB to Derby. I went through
the steps at  http://db.apache.org/derby/integrate/db_ddlutils.html
<http://db.apache.org/derby/integrate/db_ddlutils.html>   but i had a
problem when i run the export Ant task. 
The following text includes the environment variables i set & the failure
message from Ant alongside with the build.xml file. The database URL  is
correct & works fine in the JVM.
*
The environment variables :
*
afr0ck@afr0ck:~/Desktop/ESTORE/ddlutils$ echo $CLASSPATH 
/home/afr0ck/Desktop/ESTORE/sqlite-jdbc-3.21.0.jar:/home/afr0ck/Desktop/ESTORE/db-derby-10.14.1.0-lib/lib/derby.jar:/home/afr0ck/Desktop/ESTORE/db-derby-10.14.1.0-lib/lib/derbytools.jar:/home/afr0ck/Desktop/ESTORE/mariadb-java-client-2.2.1.jar
*
build.xml :
*
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;project name=&quot;MigrateToDerby&quot; basedir=&quot;.&quot;&gt;
   &lt;path id=&quot;classpath&quot;&gt;
      &lt;fileset dir=&quot;./lib&quot;&gt;
         &lt;include name=&quot;**/*.jar&quot; /&gt;
      &lt;/fileset&gt;
   &lt;/path&gt;
   &lt;target name=&quot;export-source-db&quot; description=&quot;Dumps db
structure and data&quot;&gt;
      &lt;taskdef name=&quot;databaseToDdl&quot;
classname=&quot;org.apache.ddlutils.task.DatabaseToDdlTask&quot;&gt;
         &lt;classpath refid=&quot;classpath&quot; /&gt;
      &lt;/taskdef&gt;
      &lt;databaseToDdl modelName=&quot;MigrateTest&quot;&gt;
          &lt;database url=&quot;jdbc:mariadb://localhost:3306/estore&quot;
driverClassName=&quot;org.mariadb.jdbc.Driver&quot;
username=&quot;root&quot; password=&quot;afr0ck&quot; /&gt;
         &lt;writeSchemaToFile outputFile=&quot;db-schema.xml&quot; /&gt;
         &lt;writeDataToFile outputFile=&quot;data.xml&quot; /&gt;
      &lt;/databaseToDdl&gt;
   &lt;/target&gt;
&lt;/project&gt;

*
Ant task execution :
*
afr0ck@afr0ck:~/Desktop/ESTORE/ddlutils$ ant -v export-source-db
Apache Ant(TM) version 1.10.3 compiled on March 24 2018
Trying the default build file: build.xml
Buildfile: /home/afr0ck/Desktop/ESTORE/ddlutils/build.xml
Detected Java version: 1.8 in: /home/afr0ck/jdk1.8.0_144/jre
Detected OS: Linux
parsing buildfile /home/afr0ck/Desktop/ESTORE/ddlutils/build.xml with URI =
file:/home/afr0ck/Desktop/ESTORE/ddlutils/build.xml
Project base dir set to: /home/afr0ck/Desktop/ESTORE/ddlutils
parsing buildfile
jar:file:/usr/local/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with
URI = jar:file:/usr/local/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml
from a zip file
Build sequence for target(s) `export-source-db' is [export-source-db]
Complete build sequence is [export-source-db, ]

export-source-db:

BUILD FAILED/home/afr0ck/Desktop/ESTORE/ddlutils/build.xml:12: Could not
read the schema from the specified database: Database type null is not
supported.
	at
org.apache.ddlutils.task.PlatformConfiguration.getPlatform(PlatformConfiguration.java:226)
	at
org.apache.ddlutils.task.DatabaseTaskBase.getPlatform(DatabaseTaskBase.java:288)
	at
org.apache.ddlutils.task.DatabaseToDdlTask.readModel(DatabaseToDdlTask.java:265)
	at
org.apache.ddlutils.task.DatabaseTaskBase.execute(DatabaseTaskBase.java:381)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:350)
	at org.apache.tools.ant.Target.execute(Target.java:448)
	at org.apache.tools.ant.Target.performTasks(Target.java:469)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1370)
	at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
	at org.apache.tools.ant.Main.runBuild(Main.java:849)
	at org.apache.tools.ant.Main.startAnt(Main.java:228)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:283)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
Caused by: java.lang.NullPointerException
	at
org.apache.ddlutils.PlatformFactory.createNewPlatformInstance(PlatformFactory.java:83)
	at
org.apache.ddlutils.task.PlatformConfiguration.getPlatform(PlatformConfiguration.java:222)
	... 20 more

Total time: 0 seconds

What could be wrong with the above configuration ?



--
Sent from: http://apache-database.10148.n7.nabble.com/Apache-Derby-Users-f95095.html

Re: Migrate from MariaDB to Derby using DdlUtils : Ant task failure

Posted by Bryan Pendleton <bp...@gmail.com>.
I don't think the DdlUtils mailing lists are active anymore. The DB
project retired the DdlUtils mailing lists in the fall of 2016, as
that subproject is entirely inactive now. I think this is the first
DdlUtils question that's appeared on any of the mailing lists in 5
years.

bryan

On Wed, May 2, 2018 at 3:45 PM, Rick Hillegas <ri...@gmail.com> wrote:
> I recommend that you post this question to the DdlUtils user list if you
> want to use DdlUtils for this task. I don't think that you will find a lot
> of DdlUtils expertise on the Derby lists. But maybe someone will speak up
> and happily contradict me.
>
> Another approach would be to use the foreignViews optional tool as
> documented here:
> http://db.apache.org/derby/docs/10.14/tools/rtoolsoptforeignviews.html. An
> advantage to this approach is that you don't have to indirect through a
> dumped data file on disk. The foreignViews will siphon the data out of
> MariaDB and drop it directly into the target Derby tables.
>
> Hope this helps,
> -Rick
>
>
> On 5/2/18 1:31 PM, afr0ck wrote:
>
> Hello,
>
> So i had to convert my production DB from MariaDB to Derby. I went through
> the steps at http://db.apache.org/derby/integrate/db_ddlutils.html but i had
> a problem when i run the export Ant task.
> The following text includes the environment variables i set & the failure
> message from Ant alongside with the build.xml file. The database URL is
> correct & works fine in the JVM.
>
> The environment variables :
>
>
> afr0ck@afr0ck:~/Desktop/ESTORE/ddlutils$ echo $CLASSPATH
> /home/afr0ck/Desktop/ESTORE/sqlite-jdbc-3.21.0.jar:/home/afr0ck/Desktop/ESTORE/db-derby-10.14.1.0-lib/lib/derby.jar:/home/afr0ck/Desktop/ESTORE/db-derby-10.14.1.0-lib/lib/derbytools.jar:/home/afr0ck/Desktop/ESTORE/mariadb-java-client-2.2.1.jar
>
> build.xml :
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project name="MigrateToDerby" basedir=".">
> <path id="classpath">
> <fileset dir="./lib">
> <include name="**/*.jar" />
> </fileset>
> </path>
> <target name="export-source-db" description="Dumps db structure and data">
> <taskdef name="databaseToDdl"
> classname="org.apache.ddlutils.task.DatabaseToDdlTask">
> <classpath refid="classpath" />
> </taskdef>
> <databaseToDdl modelName="MigrateTest">
> <database url="jdbc:mariadb://localhost:3306/estore"
> driverClassName="org.mariadb.jdbc.Driver" username="root" password="afr0ck"
> />
> <writeSchemaToFile outputFile="db-schema.xml" />
> <writeDataToFile outputFile="data.xml" />
> </databaseToDdl>
> </target>
> </project>
>
> Ant task execution :
>
>
> afr0ck@afr0ck:~/Desktop/ESTORE/ddlutils$ ant -v export-source-db
> Apache Ant(TM) version 1.10.3 compiled on March 24 2018
> Trying the default build file: build.xml
> Buildfile: /home/afr0ck/Desktop/ESTORE/ddlutils/build.xml
> Detected Java version: 1.8 in: /home/afr0ck/jdk1.8.0_144/jre
> Detected OS: Linux
> parsing buildfile /home/afr0ck/Desktop/ESTORE/ddlutils/build.xml with URI =
> file:/home/afr0ck/Desktop/ESTORE/ddlutils/build.xml
> Project base dir set to: /home/afr0ck/Desktop/ESTORE/ddlutils
> parsing buildfile
> jar:file:/usr/local/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with
> URI = jar:file:/usr/local/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml
> from a zip file
> Build sequence for target(s) `export-source-db' is [export-source-db]
> Complete build sequence is [export-source-db, ]
>
> export-source-db:
>
> BUILD FAILED /home/afr0ck/Desktop/ESTORE/ddlutils/build.xml:12: Could not
> read the schema from the specified database: Database type null is not
> supported.
> at
> org.apache.ddlutils.task.PlatformConfiguration.getPlatform(PlatformConfiguration.java:226)
> at
> org.apache.ddlutils.task.DatabaseTaskBase.getPlatform(DatabaseTaskBase.java:288)
> at
> org.apache.ddlutils.task.DatabaseToDdlTask.readModel(DatabaseToDdlTask.java:265)
> at
> org.apache.ddlutils.task.DatabaseTaskBase.execute(DatabaseTaskBase.java:381)
> at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
> at org.apache.tools.ant.Task.perform(Task.java:350)
> at org.apache.tools.ant.Target.execute(Target.java:448)
> at org.apache.tools.ant.Target.performTasks(Target.java:469)
> at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
> at org.apache.tools.ant.Project.executeTarget(Project.java:1370)
> at
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
> at org.apache.tools.ant.Main.runBuild(Main.java:849)
> at org.apache.tools.ant.Main.startAnt(Main.java:228)
> at org.apache.tools.ant.launch.Launcher.run(Launcher.java:283)
> at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
> Caused by: java.lang.NullPointerException
> at
> org.apache.ddlutils.PlatformFactory.createNewPlatformInstance(PlatformFactory.java:83)
> at
> org.apache.ddlutils.task.PlatformConfiguration.getPlatform(PlatformConfiguration.java:222)
> ... 20 more
>
> Total time: 0 seconds
>
> What could be wrong with the above configuration ?
> ________________________________
> Sent from the Apache Derby Users mailing list archive at Nabble.com.
>
>

Re: Migrate from MariaDB to Derby using DdlUtils : Ant task failure

Posted by Rick Hillegas <ri...@gmail.com>.
I recommend that you post this question to the DdlUtils user list if you 
want to use DdlUtils for this task. I don't think that you will find a 
lot of DdlUtils expertise on the Derby lists. But maybe someone will 
speak up and happily contradict me.

Another approach would be to use the foreignViews optional tool as 
documented here: 
http://db.apache.org/derby/docs/10.14/tools/rtoolsoptforeignviews.html. 
An advantage to this approach is that you don't have to indirect through 
a dumped data file on disk. The foreignViews will siphon the data out of 
MariaDB and drop it directly into the target Derby tables.

Hope this helps,
-Rick

On 5/2/18 1:31 PM, afr0ck wrote:
> Hello,
>
> So i had to convert my production DB from MariaDB to Derby. I went 
> through the steps at 
> http://db.apache.org/derby/integrate/db_ddlutils.html but i had a 
> problem when i run the export Ant task.
> The following text includes the environment variables i set & the 
> failure message from Ant alongside with the build.xml file. The 
> database URL is correct & works fine in the JVM.
> *
>
>
>       The environment variables :
>
> *
> |afr0ck@afr0ck:~/Desktop/ESTORE/ddlutils$ echo $CLASSPATH
> /home/afr0ck/Desktop/ESTORE/sqlite-jdbc-3.21.0.jar:/home/afr0ck/Desktop/ESTORE/db-derby-10.14.1.0-lib/lib/derby.jar:/home/afr0ck/Desktop/ESTORE/db-derby-10.14.1.0-lib/lib/derbytools.jar:/home/afr0ck/Desktop/ESTORE/mariadb-java-client-2.2.1.jar 
> |
> *
>
>
>       build.xml :
>
> *
> |<?xml version="1.0" encoding="UTF-8"?>
> <project name="MigrateToDerby" basedir=".">
> <path id="classpath">
> <fileset dir="./lib">
> <include name="**/*.jar" />
> </fileset>
> </path>
> <target name="export-source-db" description="Dumps db structure and data">
> <taskdef name="databaseToDdl" 
> classname="org.apache.ddlutils.task.DatabaseToDdlTask">
> <classpath refid="classpath" />
> </taskdef>
> <databaseToDdl modelName="MigrateTest">
> <database url="jdbc:mariadb://localhost:3306/estore" 
> driverClassName="org.mariadb.jdbc.Driver" username="root" 
> password="afr0ck" />
> <writeSchemaToFile outputFile="db-schema.xml" />
> <writeDataToFile outputFile="data.xml" />
> </databaseToDdl>
> </target>
> </project>
> |
> *
>
>
>       Ant task execution :
>
> *
> |afr0ck@afr0ck:~/Desktop/ESTORE/ddlutils$ ant -v export-source-db
> Apache Ant(TM) version 1.10.3 compiled on March 24 2018
> Trying the default build file: build.xml
> Buildfile: /home/afr0ck/Desktop/ESTORE/ddlutils/build.xml
> Detected Java version: 1.8 in: /home/afr0ck/jdk1.8.0_144/jre
> Detected OS: Linux
> parsing buildfile /home/afr0ck/Desktop/ESTORE/ddlutils/build.xml with 
> URI = file:/home/afr0ck/Desktop/ESTORE/ddlutils/build.xml
> Project base dir set to: /home/afr0ck/Desktop/ESTORE/ddlutils
> parsing buildfile 
> jar:file:/usr/local/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml 
> with URI = 
> jar:file:/usr/local/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml 
> from a zip file
> Build sequence for target(s) `export-source-db' is [export-source-db]
> Complete build sequence is [export-source-db, ]
>
> export-source-db:
>
> BUILD FAILED /home/afr0ck/Desktop/ESTORE/ddlutils/build.xml:12: Could 
> not read the schema from the specified database: Database type null is 
> not supported.
> at 
> org.apache.ddlutils.task.PlatformConfiguration.getPlatform(PlatformConfiguration.java:226)
> at 
> org.apache.ddlutils.task.DatabaseTaskBase.getPlatform(DatabaseTaskBase.java:288)
> at 
> org.apache.ddlutils.task.DatabaseToDdlTask.readModel(DatabaseToDdlTask.java:265)
> at 
> org.apache.ddlutils.task.DatabaseTaskBase.execute(DatabaseTaskBase.java:381)
> at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at 
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
> at org.apache.tools.ant.Task.perform(Task.java:350)
> at org.apache.tools.ant.Target.execute(Target.java:448)
> at org.apache.tools.ant.Target.performTasks(Target.java:469)
> at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
> at org.apache.tools.ant.Project.executeTarget(Project.java:1370)
> at 
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
> at org.apache.tools.ant.Main.runBuild(Main.java:849)
> at org.apache.tools.ant.Main.startAnt(Main.java:228)
> at org.apache.tools.ant.launch.Launcher.run(Launcher.java:283)
> at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
> Caused by: java.lang.NullPointerException
> at 
> org.apache.ddlutils.PlatformFactory.createNewPlatformInstance(PlatformFactory.java:83)
> at 
> org.apache.ddlutils.task.PlatformConfiguration.getPlatform(PlatformConfiguration.java:222)
> ... 20 more
>
> Total time: 0 seconds |
>
> What could be wrong with the above configuration ?
> ------------------------------------------------------------------------
> Sent from the Apache Derby Users mailing list archive 
> <http://apache-database.10148.n7.nabble.com/Apache-Derby-Users-f95095.html> 
> at Nabble.com.