New Topic: [LB-b3] Oracle BIGINT problem when writing SQL to file

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

New Topic: [LB-b3] Oracle BIGINT problem when writing SQL to file

by Nathan Voxland-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

A new topic, '[LB-b3] Oracle BIGINT problem when writing SQL to file', has been made on a board you are watching.

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

The text of the topic is shown below:

Hi,

Base on LB-b3 revision 1157 I have the following problem when I generate an SQL file for Oracle when the table includes BIGINT types. The SQL is written to a file because of this problem so I can't check how it works when ran on the database.

Here is the changelog I use
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="2">
        <createTable tableName="COUNTRIES">
            <column name="ID" type="BIGINT">
                <constraints nullable="false" primaryKey="true" primaryKeyName="PK_COUNTRIES"/>
            </column>
            <column name="VERSION" type="BIGINT"/>
            <column name="DESCRIPTION" type="VARCHAR(255)"/>
            <column name="ISO3_CODE" type="VARCHAR(3)">
                <constraints nullable="false"/>
            </column>
        </createTable>
        </changeSet>

</databaseChangeLog>

The program used to print the SQL statements:
Code:
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\changelog3.xml", new FileSystemResourceAccessor(), new JdbcConnection(con));

        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 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;
    }

}

This is the exception throw:
Code:
liquibase.exception.MigrationFailedException: Migration failed for change set C:/temp/changelog3.xml::2::chris:
     Reason: java.lang.NumberFormatException: For input string: "19,0":
          Caused By: For input string: "19,0"
liquibase.exception.MigrationFailedException: Migration failed for change set C:/temp/changelog3.xml::2::chris:
     Reason: java.lang.NumberFormatException: For input string: "19,0":
          Caused By: For input string: "19,0"
        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:235)
        at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:25)
        at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:39)
        at liquibase.Liquibase.update(Liquibase.java:112)
        at liquibase.Liquibase.update(Liquibase.java:134)
        at nl.chriswesdorp.dbrevisionautomator.App.run(App.java:36)
        at nl.chriswesdorp.dbrevisionautomator.App.main(App.java:21)
Caused by: java.lang.NumberFormatException: For input string: "19,0"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
        at java.lang.Integer.parseInt(Integer.java:458)
        at java.lang.Integer.parseInt(Integer.java:499)
        at liquibase.database.typeconversion.core.AbstractTypeConverter.getDataType(AbstractTypeConverter.java:218)
        at liquibase.database.typeconversion.core.AbstractTypeConverter.getDataType(AbstractTypeConverter.java:156)
        at liquibase.sqlgenerator.core.CreateTableGenerator.generateSql(CreateTableGenerator.java:45)
        at liquibase.sqlgenerator.core.CreateTableGenerator.generateSql(CreateTableGenerator.java:19)
        at liquibase.sqlgenerator.SqlGeneratorChain.generateSql(SqlGeneratorChain.java:29)
        at liquibase.sqlgenerator.SqlGeneratorFactory.generateSql(SqlGeneratorFactory.java:119)
        at liquibase.executor.AbstractExecutor.applyVisitors(AbstractExecutor.java:21)
        at liquibase.executor.LoggingExecutor.outputStatement(LoggingExecutor.java:77)
        at liquibase.executor.LoggingExecutor.execute(LoggingExecutor.java:43)
        at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:893)
        at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:880)
        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:211)
        ... 6 more

Regards,

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