File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Retrieving data from  UDB table using Extender Search Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Retrieving data from  UDB table using Extender Search" Watch "Retrieving data from  UDB table using Extender Search" New topic
Author

Retrieving data from UDB table using Extender Search

Praveen K Pippiri
Greenhorn

Joined: Jun 17, 2002
Posts: 23
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


Praveen<br />Sun Certified Programmer for Java 2 Platform.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retrieving data from UDB table using Extender Search