2

I want to generate a change log XML file in liquibase using Java, which stores the information of two databases difference.

My code is:

Database database=CommandLineUtils.createDatabaseObject(MySQLConnection.class.getClassLoader(), 
                "jdbc:mysql://localhost:3306/test", "root", "admin", "com.mysql.jdbc.Driver", "", null,false,false,null,null,null,null);

        Database database2=CommandLineUtils.createDatabaseObject(MySQLConnection.class.getClassLoader(), 
                "jdbc:mysql://localhost:3306/pizzashop", "root", "admin", "com.mysql.jdbc.Driver", "", null,false,false,null,null,null,null);
      CommandLineUtils.doDiffToChangeLog("changelog.xml", database2, database,new DiffOutputControl(),null,null);

But it generates a blank changelog.xml file.

3
  • Right now, there is a typo in the script above that sends the output to 'chagelog.xml' rather than 'changelog.xml', but that could be just a typo here. Commented Aug 25, 2014 at 17:55
  • I have changed my code but still the result is same Commented Aug 25, 2014 at 18:09
  • could you set logLevel=DEBUG in your liquibase properties file and then attach the log? Commented Aug 27, 2014 at 17:32

1 Answer 1

1

I solved my question.use liquibase 2.0.3 version.

Code is:

Database database=CommandLineUtils.createDatabaseObject(MySQLConnection.class.getClassLoader(), 
                "jdbc:mysql://localhost:3306/lportal", "root", "admin", "com.mysql.jdbc.Driver", 
                null,null,null);

        Database database2=CommandLineUtils.createDatabaseObject(MySQLConnection.class.getClassLoader(), 
                "jdbc:mysql://localhost:3306/llportal", "root", "admin", "com.mysql.jdbc.Driver",
                null,null,null);
    CommandLineUtils.doDiffToChangeLog("changeLogFile.xml",database, database2)

;

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.