• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Retrieving data from UDB table using Extender Search

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic