Quick Start Tutorial with SQLite

Help
mbnoimi
2014-03-19
2014-03-21
  • mbnoimi

    mbnoimi - 2014-03-19

    I'm unable to do Quick Start Tutorial using SQLite although I did the mentioned steps exactly!

    Terminal log:

    mbnoimi@test-pc /home/mbnoimi/symmetric/tutorial/sym-corp/symmetric-3.5.18/samples $ ../bin/dbimport --engine corp-000 --format XML create_sample.xmlLog output will be written to ../logs/symmetric.log
    [] - AbstractCommandLauncher - Option: name=engine, value={corp-000}
    [] - AbstractCommandLauncher - Option: name=format, value={XML}
    -------------------------------------------------------------------------------
    An exception occurred.  Please see the following for details:
    -------------------------------------------------------------------------------
    java.lang.RuntimeException: Cannot find file create_sample.xml
        at org.jumpmind.symmetric.DbImportCommand.executeWithOptions(DbImportCommand.java:183)
        at org.jumpmind.symmetric.AbstractCommandLauncher.execute(AbstractCommandLauncher.java:130)
        at org.jumpmind.symmetric.DbImportCommand.main(DbImportCommand.java:72)
    -------------------------------------------------------------------------------
    mbnoimi@test-pc /home/mbnoimi/symmetric/tutorial/sym-corp/symmetric-3.5.18/samples $ ../bin/dbimport --engine corp-000 --format XML '/home/mbnoimi/symmetric/tutorial/sym-corp/symmetric-3.5.18/samples/create_sample.xml' 
    Log output will be written to ../logs/symmetric.log
    [] - AbstractCommandLauncher - Option: name=engine, value={corp-000}
    [] - AbstractCommandLauncher - Option: name=format, value={XML}
    [] - DatabaseWriter - Did not find the item table in the target database
    [] - DatabaseWriter - About to create table using the following definition: <table name="item">
            <column name="item_id" primaryKey="true" required="true" type="INTEGER"/>
            <column name="name" type="VARCHAR" size="100"/>
        </table>
    [] - DatabaseWriter - Did not find the item_selling_price table in the target database
    [] - DatabaseWriter - About to create table using the following definition: <table name="item_selling_price">
            <column name="item_id" primaryKey="true" required="true" type="INTEGER"/>
            <column name="store_id" primaryKey="true" required="true" type="VARCHAR" size="5"/>
            <column name="price" required="true" type="DECIMAL" size="10,2"/>
            <column name="cost" type="DECIMAL" size="10,2"/>
            <foreign-key name="fk_price_item_id" foreignTable="item">
                <reference local="item_id" foreign="item_id"/>
            </foreign-key>
        </table>
    [] - JdbcSqlTemplate - [SQLITE_ERROR] SQL error or missing database (near "CONSTRAINT": syntax error).  Failed to execute: ALTER TABLE "item_selling_price"
    ADD CONSTRAINT "fk_price_item_id" FOREIGN KEY ("item_id") REFERENCES "item" ("item_id")
    [] - DatabaseWriter - Failed to alter table using the following xml: <table name="item_selling_price">
            <column name="item_id" primaryKey="true" required="true" type="INTEGER"/>
            <column name="store_id" primaryKey="true" required="true" type="VARCHAR" size="5"/>
            <column name="price" required="true" type="DECIMAL" size="10,2"/>
            <column name="cost" type="DECIMAL" size="10,2"/>
            <foreign-key name="fk_price_item_id" foreignTable="item">
                <reference local="item_id" foreign="item_id"/>
            </foreign-key>
        </table>
    -------------------------------------------------------------------------------
    An exception occurred.  Please see the following for details:
    -------------------------------------------------------------------------------
    java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (near "CONSTRAINT": syntax error)
        at org.sqlite.DB.newSQLException(DB.java:886)
        at org.sqlite.DB.newSQLException(DB.java:897)
        at org.sqlite.DB.throwex(DB.java:864)
        at org.sqlite.NativeDB.prepare(Native Method)
        at org.sqlite.DB.prepare(DB.java:207)
        at org.sqlite.Stmt.execute(Stmt.java:152)
        at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
        at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
        at org.jumpmind.db.sql.JdbcSqlTemplate$6.execute(JdbcSqlTemplate.java:343)
        at org.jumpmind.db.sql.JdbcSqlTemplate$6.execute(JdbcSqlTemplate.java:330)
        at org.jumpmind.db.sql.JdbcSqlTemplate.execute(JdbcSqlTemplate.java:415)
     [wrapped] org.jumpmind.db.sql.SqlException: [SQLITE_ERROR] SQL error or missing database (near "CONSTRAINT": syntax error)
        at org.jumpmind.db.sql.AbstractSqlTemplate.translate(AbstractSqlTemplate.java:288)
        at org.jumpmind.db.sql.AbstractSqlTemplate.translate(AbstractSqlTemplate.java:279)
        at org.jumpmind.db.sql.JdbcSqlTemplate.execute(JdbcSqlTemplate.java:417)
        at org.jumpmind.db.sql.JdbcSqlTemplate.update(JdbcSqlTemplate.java:330)
        at org.jumpmind.db.sql.SqlScript.execute(SqlScript.java:107)
        at org.jumpmind.db.sql.SqlScript.execute(SqlScript.java:102)
        at org.jumpmind.db.platform.AbstractDatabasePlatform.createDatabase(AbstractDatabasePlatform.java:169)
        at org.jumpmind.symmetric.io.data.writer.DatabaseWriter.create(DatabaseWriter.java:941)
        at org.jumpmind.symmetric.io.data.writer.DatabaseWriter.write(DatabaseWriter.java:202)
        at org.jumpmind.symmetric.io.data.writer.DatabaseWriter.write(DatabaseWriter.java:167)
        at org.jumpmind.symmetric.io.data.DataProcessor.forEachDataInTable(DataProcessor.java:194)
        at org.jumpmind.symmetric.io.data.DataProcessor.forEachTableInBatch(DataProcessor.java:164)
        at org.jumpmind.symmetric.io.data.DataProcessor.process(DataProcessor.java:114)
        at org.jumpmind.symmetric.io.data.DataProcessor.process(DataProcessor.java:78)
        at org.jumpmind.symmetric.io.data.DbImport.importTablesFromXml(DbImport.java:208)
        at org.jumpmind.symmetric.io.data.DbImport.importTables(DbImport.java:154)
        at org.jumpmind.symmetric.DbImportCommand.executeWithOptions(DbImportCommand.java:188)
        at org.jumpmind.symmetric.AbstractCommandLauncher.execute(AbstractCommandLauncher.java:130)
        at org.jumpmind.symmetric.DbImportCommand.main(DbImportCommand.java:72)
    -------------------------------------------------------------------------------
    mbnoimi@test-pc /home/mbnoimi/symmetric/tutorial/sym-corp/symmetric-3.5.18/samples $
    
     
    Last edit: mbnoimi 2014-03-19
  • Eric Long

    Eric Long - 2014-03-20

    I think it's because SQLite has foreign keys disabled by default, but I'm not sure how to enable them from a connection string.

    Try adding "--force" to your command. You don't need to have foreign key constraints for the quickstart to work,

    ../bin/dbimport --force --engine corp-000 --format XML create_sample.xml

    You can ignore the FK errors it outputs and move on to the next step.

     
    • mbnoimi

      mbnoimi - 2014-03-21

      Thanks Eric; I could apply the tutorial perfectly.

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks