[SQLiteJDBC] NullPointerException when
jose antonio lorenzo
joanlofe at gmail.com
Sat Nov 6 22:35:49 EDT 2010
I am getting a NullPointerException when using PrepareStatement. The stack
trace is:
Exception in thread "main" java.lang.NullPointerException
at org.sqlite.PrepStmt.<init>(PrepStmt.java:37)
at org.sqlite.Conn.prepareStatement(Conn.java:231)
at org.sqlite.Conn.prepareStatement(Conn.java:224)
at org.sqlite.Conn.prepareStatement(Conn.java:213)
at
net.jalorenzofernandez.quiniela.model.Round.writeToDatabase(Round.java:184)
The line of my code that generates the exception is the following
(Round.java: 184):
PreparedStatement ps = conn.prepareStatement("INSERT INTO matches " +
"(localId, awayId, localScore, awayScore, division,
year, round) " +
"VALUES(?,?,?,?,?,?,?)");
I've checked that conn (a java.sql.Connection instance) is not null. In
fact, before the error, I write to the database using that very connection
without problem. The connection is configured with setAutoCommit(false).
Around 40 commits are made without failure before the error message appears.
Any idea about what I am doing wrong? Thank you for your answers.
More information about the SQLiteJDBC
mailing list