Hi,
using the Liquibase B3 (revision 1157) an exception is thrown when a new database is initialized on Oracle. The exception description is “Type class liquibase.database.structure.type.DateTimeType doesn’t support precision but precision was specified” which seems to come from the databasechangelog table creation.
The change log:
- <?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">
<changeSet author="chris" id="1">
And the program used:
-
// 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 {
Connection con = getOracleConnection(“jdbc:oracle:thin:@localhost:1521:DEMO”, “demo”, “local”);
Liquibase liquibase = new Liquibase(“C:\temp\changelog2.xml”, new FileSystemResourceAccessor(), new JdbcConnection(con));
try {
liquibase.update(null);
} catch (Exception e) {
System.out.println(e.toString());
e.printStackTrace();
}
}
private Connection getOracleConnection(String url, String username, String password) {
try {
Class.forName(“oracle.jdbc.OracleDriver”);
Connection con = DriverManager.getConnection(url, username, password);
return con;
} catch (SQLException ex) {
ex.printStackTrace();
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
return null;
}
}
The table is created in Oracle, but the sequence from the changelog is not. When the program is ran again it tries to create or modify the changelog table again. The exception thrown is:
- liquibase.exception.DatabaseException: liquibase.exception.UnexpectedLiquibaseException: Type class liquibase.database.structure.type.DateTimeType doesn't support precision but precision was specified
liquibase.exception.DatabaseException: liquibase.exception.UnexpectedLiquibaseException: Type class liquibase.database.structure.type.DateTimeType doesn't support precision but precision was specified
at liquibase.snapshot.core.JdbcDatabaseSnapshotGenerator.getTable(JdbcDatabaseSnapshotGenerator.java:57)
at liquibase.snapshot.core.JdbcDatabaseSnapshotGenerator.getDatabaseChangeLogTable(JdbcDatabaseSnapshotGenerator.java:30)
at liquibase.database.AbstractDatabase.checkDatabaseChangeLogTable(AbstractDatabase.java:322)
at liquibase.Liquibase.update(Liquibase.java:103)
at nl.chriswesdorp.dbrevisionautomator.App.run(App.java:36)
at nl.chriswesdorp.dbrevisionautomator.App.main(App.java:21)
Caused by: liquibase.exception.UnexpectedLiquibaseException: Type class liquibase.database.structure.type.DateTimeType doesn't support precision but precision was specified
at liquibase.database.structure.type.DataType.setFirstParameter(DataType.java:49)
at liquibase.database.typeconversion.core.AbstractTypeConverter.getDataType(AbstractTypeConverter.java:218)
at liquibase.database.typeconversion.core.AbstractTypeConverter.getDataType(AbstractTypeConverter.java:156)
at liquibase.snapshot.core.JdbcDatabaseSnapshotGenerator.getColumnTypeAndDefValue(JdbcDatabaseSnapshotGenerator.java:319)
at liquibase.snapshot.core.OracleDatabaseSnapshotGenerator.getColumnTypeAndDefValue(OracleDatabaseSnapshotGenerator.java:30)
at liquibase.snapshot.core.JdbcDatabaseSnapshotGenerator.readColumn(JdbcDatabaseSnapshotGenerator.java:154)
at liquibase.snapshot.core.JdbcDatabaseSnapshotGenerator.getTable(JdbcDatabaseSnapshotGenerator.java:52)
… 5 more
Chris