B
Baby Lion
why there is a query I can execute In mysql client ,but can not execute
in jdbc?
String sqlstring ="select host,port,username,password,LastCrawlState
from Host
Table where id ="+id;
System.out.println(sqlstring);
rs = stmt.executeQuery(sqlstring);
// THE id here equals to 1, its type is int
AND I GOT:
select host,port,username,password,LastCrawlState from HostTable where
id =1
Exception in thread "main" java.lang.NullPointerException
at Host.<init>(Host.java:65)
at TestTwo.main(TestTwo.java:9)
BUT THIS ONE CAN EXECUTE IN SQLCLIENT:
select host,port,username,password,LastCrawlState from HostTable where
id =1
in jdbc?
String sqlstring ="select host,port,username,password,LastCrawlState
from Host
Table where id ="+id;
System.out.println(sqlstring);
rs = stmt.executeQuery(sqlstring);
// THE id here equals to 1, its type is int
AND I GOT:
select host,port,username,password,LastCrawlState from HostTable where
id =1
Exception in thread "main" java.lang.NullPointerException
at Host.<init>(Host.java:65)
at TestTwo.main(TestTwo.java:9)
BUT THIS ONE CAN EXECUTE IN SQLCLIENT:
select host,port,username,password,LastCrawlState from HostTable where
id =1