New Topic: [LB2-b3] initializating oracle db gives exception on DateTimeType

View: New views
1 Messages — Rating Filter:   Alert me  

New Topic: [LB2-b3] initializating oracle db gives exception on DateTimeType

by Nathan Voxland-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

A new topic, '[LB2-b3] initializating oracle db gives exception on DateTimeType', has been made on a board you are watching.

You can see it at
http://liquibase.org/forum/index.php?topic=159.new#new

The text of the topic is shown below:

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:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="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">
        <preConditions onFail="MARK_RAN">
            <dbms type="oracle"/>
        </preConditions>
        <createSequence sequenceName="SEQ_GEN_IDENTITY" startValue="10000" />
    </changeSet>

</databaseChangeLog>

And the program used:
Code:
// 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:\tempchangelog2.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:
Code:
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

Unsubscribe to new topics from this board by clicking here: http://liquibase.org/forum/index.php?action=notifyboard;board=1.0

Regards,
The LiquiBase Community Forum Team.
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Liquibase-user mailing list
Liquibase-user@...
https://lists.sourceforge.net/lists/listinfo/liquibase-user