I have to look deeper at the exception, but I open the connection before executing any command with db.open. Maybe the connection check is not correct or empire-db closes the connection.
Best regards, El 11/07/2013 09:51, "Rainer Döbele" <[email protected]> escribió: > I have no experience with SQLLite and it is possible that not everything > has been implemented or tested properly for the SQLLite dbms.**** > > ** ** > > However your error messages indicate that there is rather a problem with > your connection:**** > > Caused by: java.sql.SQLException: database connection > closed > > **** > > Empire-db will not automatically open or close connections.**** > > ** ** > > You should first check whether your connection is established and whether > plain JDBC calls work.**** > > ** ** > > Regards**** > > Rainer**** > > ** ** > > ** ** > > *Von:* Iñigo Martínez [mailto:[email protected]] > *Gesendet:* Mittwoch, 10. Juli 2013 22:54 > *An:* [email protected] > *Betreff:* Problems working with SQLite**** > > ** ** > > Hello:**** > > I have to create a project where I will be working with a local database. > As I have prior experience with empire-db, I have started using it with a > sqlite database.**** > > I am using the xerial sqlite driver as it looks like it is a fork of > zentus driver, and this one is not available anymore. Looking at jira I saw > that the empire-db database driver is based on zentus.**** > > I am getting multiple errors thought, both in the creation of the > database, and in insertion of new records.**** > > Is there any problem when using empire-db with sqlite ? Any ideas ?**** > > Thank you, > > Best regards,**** > > Error messages...**** > > ** ** > > Database creation: > > [main] INFO org.apache.empire.db.DBDDLGenerator - Adding create statmement > for table TABLE1. > [main] INFO org.apache.empire.db.DBDDLGenerator - Adding create statmement > for index TABLE1_IDX. > [main] INFO org.apache.empire.db.DBDDLGenerator - Adding create statmement > for table TABLE2. > [main] INFO org.apache.empire.db.DBDDLGenerator - Adding create statmement > for index TABLE2_IDX. > - > [main] ERROR org.apache.empire.db.DBSQLScript - java.sql.SQLException: > database connection closed > > java.sql.SQLException: database connection closed > at org.sqlite.SQLiteConnection.checkOpen(SQLiteConnection.java:300) > at > org.sqlite.SQLiteConnection.createStatement(SQLiteConnection.java:546) > at > org.sqlite.SQLiteConnection.createStatement(SQLiteConnection.java:531) > at > org.apache.empire.db.sqlite.DBDatabaseDriverSQLite.executeSQL(DBDatabaseDriverSQLite.java:141) > at org.apache.empire.db.DBSQLScript.run(DBSQLScript.java:120) > at com.imc.lfdb.Main.createDatabase(Main.java:147) > at com.imc.lfdb.Main.main(Main.java:78) > [main] INFO org.apache.empire.exceptions.EmpireException - An Error > occured. Message is: The database operation failed. Native error is: > database connection closed > Exception in thread "main" > org.apache.empire.db.exceptions.EmpireSQLException: The database operation > failed. Native error is: database connection closed > at org.apache.empire.db.DBSQLScript.run(DBSQLScript.java:126) > at com.imc.lfdb.Main.createDatabase(Main.java:147) > at com.imc.lfdb.Main.main(Main.java:78) > Caused by: java.sql.SQLException: database connection closed > at org.sqlite.SQLiteConnection.checkOpen(SQLiteConnection.java:300) > at > org.sqlite.SQLiteConnection.createStatement(SQLiteConnection.java:546) > at > org.sqlite.SQLiteConnection.createStatement(SQLiteConnection.java:531) > at > org.apache.empire.db.sqlite.DBDatabaseDriverSQLite.executeSQL(DBDatabaseDriverSQLite.java:141) > at org.apache.empire.db.DBSQLScript.run(DBSQLScript.java:120) > ... 2 more**** > > If I create the database by hand, these are the errors on insertion: > > [main] ERROR org.apache.empire.db.**** > > DBDatabaseDriver - Error executing query 'SELECT t1.ID > FROM TABLE2 t1 > WHERE t1.NAME='Arenas'' --> database connection closed > java.sql.SQLException: database connection closed > at org.sqlite.SQLiteConnection.checkOpen(SQLiteConnection.java:300) > at > org.sqlite.SQLiteConnection.createStatement(SQLiteConnection.java:546) > at > org.sqlite.SQLiteConnection.createStatement(SQLiteConnection.java:539) > at > org.apache.empire.db.DBDatabaseDriver.executeQuery(DBDatabaseDriver.java:593) > at > org.apache.empire.db.DBDatabase.querySingleValue(DBDatabase.java:766) > at org.apache.empire.db.DBDatabase.querySingleInt(DBDatabase.java:836) > at org.apache.empire.db.DBDatabase.querySingleInt(DBDatabase.java:866) > at com.imc.lfdb.Main.getData(Main.java:193) > at com.imc.lfdb.Main.insertData(Main.java:159) > at com.imc.lfdb.Main.main(Main.java:100) > [main] ERROR org.apache.empire.db.exceptions.QueryFailedException - Error > executing query SELECT t1.ID > FROM TABLE2 t1 > WHERE t1.NAME='Arenas'. > Native error is: database connection closed > [main] INFO org.apache.empire.db.DBDatabase - Executing: INSERT INTO > TABLE2( NAME) VALUES ( 'Arenas') > [main] ERROR org.apache.empire.db.exceptions.StatementFailedException - > Error executing statement INSERT INTO TABLE2( NAME) VALUES ( 'Arenas'). > Native error is: database connection closed > Exception in thread "main" > org.apache.empire.db.exceptions.StatementFailedException: Error executing > statement INSERT INTO TABLE2( NAME) VALUES ( 'Arenas'). > Native error is: database connection closed > at org.apache.empire.db.DBDatabase.executeSQL(DBDatabase.java:1293) > at org.apache.empire.db.DBRowSet.updateRecord(DBRowSet.java:818) > at org.apache.empire.db.DBRecord.update(DBRecord.java:795) > at com.imc.lfdb.Main.insertData(Main.java:202) > at com.imc.lfdb.Main.insertData(Main.java:162) > at com.imc.lfdb.Main.main(Main.java:100) > Caused by: java.sql.SQLException: database connection closed > at org.sqlite.SQLiteConnection.checkOpen(SQLiteConnection.java:300) > at > org.sqlite.SQLiteConnection.createStatement(SQLiteConnection.java:546) > at > org.sqlite.SQLiteConnection.createStatement(SQLiteConnection.java:531) > at > org.apache.empire.db.sqlite.DBDatabaseDriverSQLite.executeSQL(DBDatabaseDriverSQLite.java:141) > at org.apache.empire.db.DBDatabase.executeSQL(DBDatabase.java:1278) > ... 5 more**** >
