Hi All,
I have a very trivial problem.I am trying to read some data from UDB table which is enable for search using Text extender.
I am using the following query to retrive the data
pstmt = con.prepareStatement("SELECT * FROM EAIM.DOC_CURVER_TBL WHERE DB2TX.CONTAINS(CHAPTERHANDLE,'\"?\"')=1");
It is throwing Null Pointer Exception at the parameter setting.
Error Message as follows:
java.lang.NullPointerException at sun.jdbc.odbc.JdbcOdbcPreparedStatement.clearParameter(JdbcOdbcPreparedStatement.java:1026)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setChar(JdbcOdbcPreparedStatement.java:2778)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setString(JdbcOdbcPreparedStatement.java:772)
at DocSearchTest.main(DocSearchTest.java:42)
I tried with the following combinations
(CHAPTERHANDLE,'\""+"?"+"\"')
(CHAPTERHANDLE,'\""+'?'+"\"')
(CHAPTERHANDLE,'?')
If I use the following
pattern (CHAPTERHANDLE,?)
I am getting the following Message,which is related to extender.
Exception e1[IBM][CLI Driver][DB2/NT] SQL0443N Routine "DB2TX.CONTAINS" (specific name "DES5A") has returned an error SQLSTATE with diagnostic text "DES38708 RC_SE_EMPTY_QUERY. Search failed.". SQLSTATE=38708
java.sql.SQLException: [IBM][CLI Driver][DB2/NT] SQL0443N Routine "DB2TX.CONTAINS" (specific name "DES5A") has returned an error SQLSTATE with diagnostic text "DES38708 RC_SE_EMPTY_QUERY. Search failed.". SQLSTATE=38708
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6106)
If I use the variable instead of ? i.e,(CHAPTERHANDLE,'\""+chapterID+"\"')in the sql statement then it works But I want to use ?.
Basically The Extender expects the quesry in the following pattern
WHERE DB2TX.CONTAINS(handle,'"some string"')=1");
Could anyone please advice me how to produce the sql
string in that pattern??
Thanks