Hi,
Trying the Liquibase B3 (from subversion, revision 1157) I have the following problem. The changelog includes a changeset to create a sequence on Oracle and is marked with a pre-condition which checks the database type. When the file is executed against a MySQL database and the SQL is not executed but printed on screen, liquibase crashes on the createSequence tag.
This is the changelog
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
http://www.liquibase.org/xml/ns/dbchangelog/1.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
And this is the program executing liquibase:
-
// package and imports
public class App {
public static void main(String[] args) throws Exception {
App a = new App();
a.run();
}
public void run() throws Exception {
OracleTypeConverter otc = new OracleTypeConverter();
System.out.println(otc.getDoubleType().toString());
Connection con = getMysqlConnection(“jdbc:mysql://localhost:3306/ht_empty”, “test”, “test”);
Liquibase liquibase = new Liquibase(“C:\temp\changelog_with_generator.xml”, new FileSystemResourceAccessor(), new JdbcConnection(con));
// store the SQL in a String
StringWriter sw = new StringWriter();
try {
liquibase.update(null, sw);
} catch (Exception e) {
System.out.println(e.toString());
e.printStackTrace();
}
System.out.println(sw.toString());
}
private Connection getMysqlConnection(String url, String username, String password) {
try {
Class.forName(“com.mysql.jdbc.Driver”);
Connection con = DriverManager.getConnection(url, username, password);
return con;
} catch (SQLException ex) {
ex.printStackTrace();
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
return null;
}
}
When the SQL is executed on the database no exceptions are thrown. The change set is marked_ran as expected in the databasechangelog table.
Regards,
Chris