I have a newly created sqlite database, it is somewhat large: about 6.3 GB. I have no problem using it with the sqlite command line tool. When I try to connect using JDBC (groovy script), I got an exception:
Caught: java.sql.SQLException: [SQLITE_CORRUPT] The database disk image is malformed (database disk image is malformed)
Then I ran from the sqlite command line tool:
pragma integrity_check;
Reported: ok
I tried a groovy script for a new database with one table with one row and it seems to work.
Any suggestions?
via:
jdk1.7.0_60
groovy -2.3.4
SQLite-3.7.2-JDBC
groovy script:
import java.sql.Connection import java.sql.DriverManager import java.sql.ResultSet println("hello world") Class.forName("org.sqlite.JDBC") String dbFile = "/opt/no_backup/text_analytics/db/options.sqlite3" //large database - exception // "/opt/no_backup/text_analytics/test/test.db" //small database - works Connection conn = DriverManager.getConnection("jdbc:sqlite:$dbFile") String query = // "select count(*) from test" //small database - works "select count(*) from bb_options where underlyingSymbol='GE'" //large database - fails ResultSet rs = conn.createStatement().executeQuery(query) while(rs.next()) { println(rs.getInt(1)) } conn.close()
source share