|
From: leks <le...@da...> - 2012-01-17 13:53:31
|
i can't use PreparedStatement with parameterers because of strange
"java.lang.NullPointerException: null" error
The exception occures at following line:
java.sql.PreparedStatement st = conn.prepareStatement(sql);
please note 'conn' object is not null and 'sql' is also not null.
The exception may occur or not depending on number of parameters in prepared
statement and order of parameteres
for example, this sql works fine:
"select id, adate"
from DATA v where 1=1 and id not in (1,0,10000)"
and id=?"
and this works fine
"select id, adate"
from DATA v where 1=1 and id not in (1,0,10000)"
and adate>? and adate<?"
and this works fine:
"select id, adate"
from DATA v where 1=1 and id not in (1,0,10000)"
and adate>? and id=?"
but this sql causes exception:
"select id, adate"
from DATA v where 1=1 and id not in (1,0,10000)"
and id=?"
and adate>? and adate<?"
here is my code
Class.forName("org.luciddb.jdbc.LucidDbClientDriver").newInstance();
java.sql.Connection conn =
java.sql.DriverManager.getConnection("jdbc:luciddb:http://192.168.254.166","sa","");
sql = xxxxx
java.sql.PreparedStatement st = conn.prepareStatement(sql); - Exception is
here!!!
Please advise,
thank you.
Leks
--
View this message in context: http://luciddb-users.1374590.n2.nabble.com/i-can-t-use-PreparedStatement-with-parameterers-because-of-strange-java-lang-NullPointerException-nu-tp7196313p7196313.html
Sent from the luciddb-users mailing list archive at Nabble.com.
|