|
Hello! I have question related to com.ibm.as400.access.AS400JDBCDriver() and it's about SCROLL CURSOR. I've noticed if I use TYPE_SCROLL_SENSITIVE cursor like in example: Statement select = connection.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); that result set: ResultSet rs = select.executeQuery("SELECT CNUM,NAME1,NAME2 FROM dbfile1 WHERE NAME2 LIKE 'some_name%'"); doesn't work (I mean there aren't any data in it). But if I change criteria and search rows by custNumber (which is number:) ResultSet rs = select.executeQuery("SELECT CNUM,NAME1,NAME2 FROM dbfile1 WHERE CNUM BETWEEN 7 AND 500"); it'll work. I was confused and had enough time to try to change "SENSITIVITY" like this: Statement select = connection.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); after this, both comparisons character (with LIKE) and numeric (with between) worked. I went one step further and tried whole story again but with prepared statement: PreparedStatement ps=this .connection.prepareStatement(queryToPrepare,ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); ResultSet rs = ps.executeQuery(); In case of numeric comparison in WHERE CLAUSE all worked fine but if PreparedStatement contains character comparison, result set would be empty. The same situation occures if I apply ResultSet.TYPE_SCROLL_SENSITIVE to PreparedStatement. I tried to find any useful information on the web but seems that only midrange informations on are useful. Information center is good but it deals with only simple examples. I have no idea why I have different results and are there some limitations I missplaced? Here is result of supportsResultSetType methods: DatabaseMetaData dmd = connection.getMetaData (); pw.write("<br> SCROLLABILITY_INSENSITIVE=" +dmd.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE)); pw.write("<br> SCROLLABILITY_SENSITIVE=" +dmd.supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE)); it is SCROLLABILITY_INSENSITIVE=false SCROLLABILITY_SENSITIVE=true I don't know how this info can help me? I don't have to sens changes on result set etc. I just want to be able to set cursor position somwhere in resultSet and read desired number of records. Afcourse, with use of PreparedStatement. Has anyone any sugestion what is problem here? I still can use clasical connection.createStatement but then I have no any use of SQL package related to driver... Best regards and thanks! Igor Bešlić, dipl. ing. rač. VOLKSBANK d.d. OJ Informatika Zelinska 2, 10000 Zagreb tel: +385 1 6326422
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.