Export to GitHub

sqlite-jdbc - issue #28

SQLITE_NOTADB : file is encrypted when setting sqlite.purejava to true


Posted on Jul 3, 2012 by Massive Lion

What steps will reproduce the problem? Create a Java class "Sqlite_notadb" with the following content and run it:

{{{ import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement;

public class Sqlite_notadb { public static void main(String[] args) throws ClassNotFoundException, SQLException { System.setProperty("sqlite.purejava", "true"); Class.forName("org.sqlite.JDBC"); Connection connection = DriverManager.getConnection("jdbc:sqlite:AddressBook.sqlitedb"); Statement statement = connection.createStatement(); ResultSet rs = statement.executeQuery("select first, last from ABPerson where first is not null order by first"); } } }}}

What is the expected output? What do you see instead? Expected: No error. Instead: {{{java.sql.SQLException: [SQLITE_NOTADB] File opened that is not a database file (file is encrypted or is not a database)}}}

What version of the product are you using? On what operating system? sqlite-jdbc-3.7.2.jar or sqlite-jdbc-3.7.6.3-20110609.081603-3.jar Windows XP SP3 JDK 1.7.0_04, Eclipse set to compliance 'J2SE-1.5'

Please provide any additional information below. Supposed reason of error: "Beginning with version 3.7.0, a new 'Write-Ahead Log' option (hereafter referred to as "WAL") is available." [...] "Thus, if an older version of SQLite attempts to connect to an SQLite database that is operating in WAL mode, it will report an error along the lines of 'file is encrypted or is not a database'."

Comment #1

Posted on Jul 3, 2012 by Massive Lion

Wiki syntax for code blocks was not applied (http://code.google.com/p/support/wiki/WikiSyntax#Code) - {{{Code}}}

Comment #2

Posted on Jul 3, 2012 by Massive Lion

Forgot citation source for additional info: http://www.sqlite.org/wal.html

Comment #3

Posted on Jul 3, 2012 by Massive Lion

Forgot another thing regarding reproducing the problem: One needs a file "AddressBook.sqlitedb" which is WAL-enabled placed in the same directory as the class. The SQL-query can be arbitrary but must be valid, for example "select nothing from notexistingtable".

Comment #4

Posted on Sep 8, 2012 by Quick Panda

Comment deleted

Comment #5

Posted on Sep 10, 2012 by Quick Panda

Replied to on bitbucket: https://bitbucket.org/xerial/sqlite-jdbc/issue/8

Comment #6

Posted on Sep 12, 2012 by Quick Panda

(No comment was entered for this change.)

Status: Fixed

Labels:
Type-Defect Priority-Medium AffectedVersion-3.7.x FixedVersion-NA