1

I am working on application in JAVA that gets data from database, makes some calculation and writes data to xml file. Everything is fine with small databases (smaller than 1 GB). However, when I run program with database which is bigger than 1 GB my application is not able to create index in database - it throws SQLException - Database image is malformed. Same in case of retrieving data from database by specific column value.

Code which cause exception:

Statement st = con.createStatement();
st.setQueryTimeout(60);
st.executeUpdate("CREATE INDEX if not exists IX_name ON myTable (name)");

I use driver org.sqlite.JDBC - sqlite-jdbc version 3.8.11. All commands work fine with smaller databases and I have a control over memory - exception is not caused by no memory. I work on Windows 10 and my computer has 8,00 GB RAM. Database which causes exception is big around 1,5 GB. Database is not corrupted (I tried more big databases and all cause same exception).

Can anybody help me? Is there a better driver for accessing large databases?

Thank you for your answers.

kumi
  • 19
  • 2
  • Did you try to do the same but with another tool (some db admin or whatever there for SQLite)? Also did you read that article - https://techblog.dorogin.com/sqliteexception-database-disk-image-is-malformed-77e59d547c50#.bxhxmg2vu ? It's first link in google. – Divers Mar 18 '17 at 22:20
  • I certainly hope you are working against a copy of the database when modifying or working with your code. Generally the **Database image is malformed** message would indicate corruption of sorts within a database file. You may need to revert back to a backup of the database. – DevilsHnd - 退職した Mar 18 '17 at 22:44
  • Run `PRAGMA integrity_check`. Try to [recreate the database file](http://stackoverflow.com/questions/18259692/how-to-recover-a-corrupt-sqlite3-database), and check again. But you should restore a correct version of that database from backup. – CL. Mar 19 '17 at 08:37
  • Providing the stacktrace can be helpful and also explain "`Database which causes exception is big around 1,5 GB. Database is not corrupted (I tried more big databases and all cause same exception).`" – N00b Pr0grammer Apr 23 '17 at 11:03

0 Answers0