Scrollable Resultset

Hi,
I'm using Oracle ODBC Driver for Rdb 2.00.18.00. The Rdb version is 06.01.0400.
When using the JDBC ODBC bridge, I'm getting the error TYPE_FORWARD_ONLY when I try to use the previous() methods.
I tried this: stmt = conn.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY );
but still get the same error.
Any suggestions?
Thanks,
Paul

Is this a Java app? Why use Oracle ODBC and the bridge when you could use their 100% Java, type IV JDBC driver? It's free to download from Oracle after you register:
http://otn.oracle.com/software/tech/java/sqlj_jdbc/index.html

Similar Messages

  • Scrollable resultsets are not supported in my application

    I want to use scrollable resultsets.But when i am writing the code
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              String url = "jdbc:odbc:pmora";
              Connection con = DriverManager.getConnection(url,
    "jbel", "jbel");
              Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    ResultSet srs = stmt.executeQuery(
    "SELECT COF_NAME, PRICE FROM COFFEES");
    while (srs.next()) {
         String name = srs.getString("COF_NAME");
         float price = srs.getFloat("PRICE");
         System.out.println(name + " " + price);
    To get support for scrollable resultsets, what driver we should use?Where we can get it?
    #database is oracle 8
    #driver version 2
    #jdbcodbcbridgedriver
    #While running the class, The followingmessage is getting displayed
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D366658
    Function=[Unknown.]
    Library=D:\j2sdk1.4.0_01\jre\bin\client\jvm.dll
    NOTE: We are unable to locate the function name symbol for the error
    just occurred. Please refer to release documentation for possible
    reason and solutions.
    Current Java thread:
         at sun.jdbc.odbc.JdbcOdbc.setStmtAttrPtr(Native Method)
         at sun.jdbc.odbc.JdbcOdbc.SQLSetStmtAttrPtr(JdbcOdbc.java:4676)
         at sun.jdbc.odbc.JdbcOdbcResultSet.setRowStatusPtr(JdbcOdbcResultSet.java:4473)
         at sun.jdbc.odbc.JdbcOdbcResultSet.initialize(JdbcOdbcResultSet.java:171)
         at sun.jdbc.odbc.JdbcOdbcStatement.getResultSet(JdbcOdbcStatement.java:423)
         - locked <02A3D7F0> (a sun.jdbc.odbc.JdbcOdbcStatement)
         at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:253)
         at ScrollableRS.main(ScrollableRS.java:27)
    Dynamic libraries:
    0x00400000 - 0x00406000      D:\j2sdk1.4.0_01\bin\java.exe
    0x77F50000 - 0x77FF9000      C:\WINNT\System32\ntdll.dll
    0x77E60000 - 0x77F45000      C:\WINNT\system32\kernel32.dll
    0x77DD0000 - 0x77E5B000      C:\WINNT\system32\ADVAPI32.dll
    0x77CC0000 - 0x77D35000      C:\WINNT\system32\RPCRT4.dll
    0x77C10000 - 0x77C63000      C:\WINNT\system32\MSVCRT.dll
    0x6D330000 - 0x6D445000      D:\j2sdk1.4.0_01\jre\bin\client\jvm.dll
    0x77D40000 - 0x77DCD000      C:\WINNT\system32\USER32.dll
    0x77C70000 - 0x77CB0000      C:\WINNT\system32\GDI32.dll
    0x76B40000 - 0x76B6C000      C:\WINNT\System32\WINMM.dll
    0x6D1D0000 - 0x6D1D7000      D:\j2sdk1.4.0_01\jre\bin\hpi.dll
    0x6D300000 - 0x6D30D000      D:\j2sdk1.4.0_01\jre\bin\verify.dll
    0x6D210000 - 0x6D228000      D:\j2sdk1.4.0_01\jre\bin\java.dll
    0x6D320000 - 0x6D32D000      D:\j2sdk1.4.0_01\jre\bin\zip.dll
    0x6D250000 - 0x6D25A000      D:\j2sdk1.4.0_01\jre\bin\JdbcOdbc.dll
    0x1F7B0000 - 0x1F7E1000      C:\WINNT\System32\ODBC32.dll
    0x77340000 - 0x773CB000      C:\WINNT\system32\COMCTL32.dll
    0x763B0000 - 0x763F5000      C:\WINNT\system32\comdlg32.dll
    0x772D0000 - 0x77333000      C:\WINNT\system32\SHLWAPI.dll
    0x773D0000 - 0x77BC4000      C:\WINNT\system32\SHELL32.dll
    0x71950000 - 0x71A34000      C:\WINNT\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.0.0_x-ww_1382d70a\comctl32.dll
    0x1F850000 - 0x1F866000      C:\WINNT\System32\odbcint.dll
    0x0AF30000 - 0x0AF99000      E:\Oracle\Ora81\BIN\SQORA32.DLL
    0x60600000 - 0x60682000      E:\Oracle\Ora81\BIN\oracore8.dll
    0x60800000 - 0x60848000      E:\Oracle\Ora81\BIN\oranls8.dll
    0x10000000 - 0x1001A000      E:\Oracle\Ora81\BIN\OCI.dll
    0x0B0B0000 - 0x0B0BF000      E:\Oracle\Ora81\bin\sqresUS.dll
    0x60400000 - 0x60502000      E:\Oracle\Ora81\bin\OraClient8.Dll
    0x0B1D0000 - 0x0B1D6000      E:\Oracle\Ora81\bin\oravsn8.dll
    0x60200000 - 0x60264000      E:\Oracle\Ora81\bin\oracommon8.dll
    0x60000000 - 0x6011F000      E:\Oracle\Ora81\bin\orageneric8.dll
    0x60350000 - 0x60356000      E:\Oracle\Ora81\bin\orawtc8.dll
    0x60A00000 - 0x60A2B000      E:\Oracle\Ora81\bin\oranl8.dll
    0x60B00000 - 0x60BAA000      E:\Oracle\Ora81\bin\oran8.dll
    0x60E00000 - 0x60E10000      E:\Oracle\Ora81\bin\orancrypt8.dll
    0x61100000 - 0x61137000      E:\Oracle\Ora81\bin\oranro8.dll
    0x71AD0000 - 0x71AD8000      C:\WINNT\system32\WSOCK32.dll
    0x71AB0000 - 0x71AC5000      C:\WINNT\system32\WS2_32.dll
    0x71AA0000 - 0x71AA8000      C:\WINNT\system32\WS2HELP.dll
    0x0B1E0000 - 0x0B23E000      E:\Oracle\Ora81\bin\orannzsbb8.dll
    0x61500000 - 0x6150E000      E:\Oracle\Ora81\bin\oranldap8.dll
    0x61700000 - 0x6171C000      E:\Oracle\Ora81\bin\oraldapclnt8.dll
    0x771B0000 - 0x772CA000      C:\WINNT\system32\ole32.dll
    0x77120000 - 0x771AB000      C:\WINNT\system32\OLEAUT32.dll
    0x61900000 - 0x61906000      E:\Oracle\Ora81\bin\oranhost8.dll
    0x62100000 - 0x62106000      E:\Oracle\Ora81\bin\oranoname8.dll
    0x0B240000 - 0x0B246000      E:\Oracle\Ora81\bin\orancds8.dll
    0x62300000 - 0x62306000      E:\Oracle\Ora81\bin\orantns8.dll
    0x62500000 - 0x62508000      E:\Oracle\Ora81\bin\orannds8.dll
    0x0B250000 - 0x0B26C000      E:\Oracle\Ora81\bin\orannms8.dll
    0x62700000 - 0x62741000      E:\Oracle\Ora81\bin\ORATRACE8.dll
    0x62900000 - 0x62B1B000      E:\Oracle\Ora81\bin\orapls8.dll
    0x63100000 - 0x63108000      E:\Oracle\Ora81\bin\oraslax8.dll
    0x63200000 - 0x63272000      E:\Oracle\Ora81\bin\orasql8.dll
    0x1F800000 - 0x1F818000      C:\WINNT\System32\odbccp32.dll
    0x77C00000 - 0x77C07000      C:\WINNT\system32\VERSION.dll
    0x71A50000 - 0x71A8B000      C:\WINNT\System32\mswsock.dll
    0x76F20000 - 0x76F45000      C:\WINNT\System32\DNSAPI.dll
    0x76D60000 - 0x76D75000      C:\WINNT\System32\iphlpapi.dll
    0x76DE0000 - 0x76E06000      C:\WINNT\System32\netman.dll
    0x76D40000 - 0x76D56000      C:\WINNT\System32\MPRAPI.dll
    0x76E40000 - 0x76E6F000      C:\WINNT\System32\ACTIVEDS.dll
    0x76E10000 - 0x76E34000      C:\WINNT\System32\adsldpc.dll
    0x71C20000 - 0x71C6F000      C:\WINNT\system32\NETAPI32.dll
    0x76F60000 - 0x76F8C000      C:\WINNT\system32\WLDAP32.dll
    0x76B20000 - 0x76B35000      C:\WINNT\System32\ATL.DLL
    0x76E80000 - 0x76E8D000      C:\WINNT\System32\rtutils.dll
    0x71BF0000 - 0x71C01000      C:\WINNT\System32\SAMLIB.dll
    0x76670000 - 0x76754000      C:\WINNT\System32\SETUPAPI.dll
    0x76EE0000 - 0x76F17000      C:\WINNT\System32\RASAPI32.dll
    0x76E90000 - 0x76EA1000      C:\WINNT\System32\rasman.dll
    0x76EB0000 - 0x76EDA000      C:\WINNT\System32\TAPI32.dll
    0x76F90000 - 0x76FA0000      C:\WINNT\System32\Secur32.dll
    0x76DA0000 - 0x76DD0000      C:\WINNT\System32\WZCSvc.DLL
    0x76D30000 - 0x76D34000      C:\WINNT\System32\WMI.dll
    0x76D80000 - 0x76D9A000      C:\WINNT\System32\DHCPCSVC.DLL
    0x762C0000 - 0x7634A000      C:\WINNT\system32\CRYPT32.dll
    0x762A0000 - 0x762AF000      C:\WINNT\system32\MSASN1.dll
    0x76F50000 - 0x76F58000      C:\WINNT\System32\WTSAPI32.dll
    0x76360000 - 0x7636F000      C:\WINNT\System32\WINSTA.dll
    0x76FB0000 - 0x76FB7000      C:\WINNT\System32\winrnr.dll
    0x76FC0000 - 0x76FC5000      C:\WINNT\System32\rasadhlp.dll
    0x64700000 - 0x6470C000      E:\Oracle\Ora81\bin\orantcp8.dll
    0x71A90000 - 0x71A98000      C:\WINNT\System32\wshtcpip.dll
    0x64500000 - 0x6450D000      E:\Oracle\Ora81\bin\orannts8.dll
    0x71F80000 - 0x71F84000      C:\WINNT\System32\security.dll
    0x76C90000 - 0x76CB2000      C:\WINNT\system32\imagehlp.dll
    0x6D510000 - 0x6D58C000      C:\WINNT\system32\DBGHELP.dll
    0x76BF0000 - 0x76BFB000      C:\WINNT\System32\PSAPI.DLL
    Local Time = Thu May 15 14:59:26 2003
    Elapsed Time = 5
    # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
    # Error ID : 4F530E43505002D5
    # Please report this error at
    # http://java.sun.com/cgi-bin/bugreport.cgi
    # Java VM: Java HotSpot(TM) Client VM (1.4.0_01-b03 mixed mode)

    You definitely don't need to be using the Sun JDBC-ODBC driver, as this will not support scrollable ResultSets. There are several drivers out there that do, ... for a list of drivers check out
    http://industry.java.sun.com/products/jdbc/drivers

  • SQLException Scrollable Resultsets

    Using JDeveloper 3.1, Weblogic 5.1, Oracle 8i
    Successfully connecting to db and extracting data with vanilla prepared statements and resultsets. Not using Oracle proprietary classes.
    Using oracle's classes12.zip and the ide classpath shows my classpath at the front.
    Tried removing all of default JDeveloper libraries, with only my custom setup remaining.
    The problem occurs at runtime from JDeveloper IDE. It all works perfectly from the command-line, but would like to have it work from IDE.
    Trying to create a Scrollable Resultset from a prepared statement.
    On the execution of the following statement:
    pStmt = conn.prepareStatement(selectSql,
    ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    Getting this error:
    java.sql.SQLException: weblogic.rmi.extensions.RemoteRuntimeException: Undeclared checked exception - with nested exception:
    [weblogic.rmi.ServerException: A remote exception occurred while executing the method on the remote object
    - with nested exception:
    [weblogic.rmi.MarshalException: error marshalling return
    - with nested exception:
    [java.io.IOException: Class weblogic.jdbc20.pool.PreparedStatement with code=123 does not implement Serializable, Externalizable or WLSerializable]]]
    at weblogic.jdbc20.rmi.SerialConnection.prepareStatement(SerialConnection.java:342)
    at aces.util.ResultsetTester.main(ResultsetTester.java, Compiled Code)
    It appears that the IDE runtime or compiler is forcing some classpath in front of mine and giving me an outdated jar, zip, class appended to the front that I cannot pinpoint, and I have tried many things.
    I do not want to use OracleResultSet just to test in the IDE. Everything works fine if I execute from the command line.
    Any concrete suggestions?

    You definitely don't need to be using the Sun JDBC-ODBC driver, as this will not support scrollable ResultSets. There are several drivers out there that do, ... for a list of drivers check out
    http://industry.java.sun.com/products/jdbc/drivers

  • How to use the wl61sp2 of scrollable resultsets

    wl61sp2 had already included mssqlserver4 , but it could not support for scrollable
    resultsets. How about using scrollable resultsets in the wl61sp2 or install the
    mssqlserver4v70rel510sp11 into the wl61sp2? If you can answer these questions,please
    help me!!!thanks
    Error:
    java.sql.SQLException: java.sql.SQLException: This JDBC 2.0 method is not implemented
    at weblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:406)at jsp_servlet._adminwww.__t._jspService(__t.java:108)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at eblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
    at eblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2204)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

    wangchuyun wrote:
    >
    wl61sp2 had already included mssqlserver4 , but it could not support for scrollable
    resultsets. How about using scrollable resultsets in the wl61sp2 or install the
    mssqlserver4v70rel510sp11 into the wl61sp2? If you can answer these questions,please
    help me!!!thanksOur driver is only at the JDBC 1.0 level in functionality. For jdbc 2.0 compliance, I
    recommend using either MS's new free type-4 driver or the good driver from
    www.inetsoftware.de.
    Joe
    >
    Error:
    java.sql.SQLException: java.sql.SQLException: This JDBC 2.0 method is not implemented
    at weblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:406)at jsp_servlet._adminwww.__t._jspService(__t.java:108)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at eblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
    at eblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2204)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

  • Using Weblogic JDBC driver 5.1.0sp8  with MSSQL, throwing "abstract method" error when trying to use scrollable resultsets

    I am using the weblogic driver with Allaire JRun.
    Using these lines, I am trying to make my resultsets scrollable and updatable.
    dbConnection.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE
    ResultSet rs = queryStatement.executeQuery(query);
    When I run the code, I get this error ..
    java.lang.AbstractMethodError
    at allaire.jrun.sql.ConnectionProxy.createStatement(../sql/ConnectionProxy.java:413)
    at com.mindseye.utils.database.DBAccessor.executeQuery(DBAccessor.java:35)
    at com.fao.shopping.tag.HandleShoppingCartTag.checkExists(HandleShoppingCartTag.java:635)
    at com.fao.shopping.tag.HandleShoppingCartTag.doStartTag(HandleShoppingCartTag.java:90)
    at jrun__jsp__shoppingbag2ejsp14._jspService(jrun__jsp__shoppingbag2ejsp14.java:45)
    at allaire.jrun.jsp.HttpJSPServlet.service(../jsp/HttpJSPServlet.java:39)
    at allaire.jrun.jsp.JSPServlet.service(../jsp/JSPServlet.java:228)
    Everything works fine when I do not try and specify attributes to the statement
    object. (i.e. dbConnection.createStatement();)
    Anybody know what is going on?
    thanks,
    randy

    Hi. I don't see our code anywhere in the stacktrace, but I'll assume
    it's there somewhere. The basic fact is that our MS SQLServer driver
    implements practically zero of the JDBC 2.0 methods. There is a way
    to connect to this driver that has the methods defined, but then all
    the difference will be that you'll get an exception saying 'this jdbc 2.0
    method not implemented'.
    Joe
    randy shepherd wrote:
    >
    I am using the weblogic driver with Allaire JRun.
    Using these lines, I am trying to make my resultsets scrollable and updatable.
    dbConnection.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE
    ResultSet rs = queryStatement.executeQuery(query);
    When I run the code, I get this error ..
    java.lang.AbstractMethodError
    at allaire.jrun.sql.ConnectionProxy.createStatement(../sql/ConnectionProxy.java:413)
    at com.mindseye.utils.database.DBAccessor.executeQuery(DBAccessor.java:35)
    at com.fao.shopping.tag.HandleShoppingCartTag.checkExists(HandleShoppingCartTag.java:635)
    at com.fao.shopping.tag.HandleShoppingCartTag.doStartTag(HandleShoppingCartTag.java:90)
    at jrun__jsp__shoppingbag2ejsp14._jspService(jrun__jsp__shoppingbag2ejsp14.java:45)
    at allaire.jrun.jsp.HttpJSPServlet.service(../jsp/HttpJSPServlet.java:39)
    at allaire.jrun.jsp.JSPServlet.service(../jsp/JSPServlet.java:228)
    Everything works fine when I do not try and specify attributes to the statement
    object. (i.e. dbConnection.createStatement();)
    Anybody know what is going on?
    thanks,
    randy

  • Problems setting scrollable ResultSet objects

    Hi, I get an "cannot resolve symbol" error when I compile my code:
    symbol : method createStatement (int)
    location: interface java.sql.Connection
    Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE);
    ^
    I'm using j2sdk1.4.1_03, and j2sdkee1.3.1, which should include a fairly updated version of the sql package. Is there something else that I should include in my path variable?
    thanks in advance.

    There's nothing wrong with your installation or your setup (at least nothing related to this question). There is simply something wrong with your code. There are three versions of the createStatement() method in the Connection interface. There are versions with 0, 2, and 3 parameters. No version with 1 parameter, which is why the compiler can't find the method you coded. Check the API documentation for details.

  • Problem with scrollable resultset of oracle

    I encountered problom like this:
    when I use
    s=createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
    and getString of a resultset,I get the right data.
    However ,when I use
    s= createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    and getString of a ResultSet ,
    if the type of the field is Date,then get right data.
    if it is char or varchar2,then i get some thing like
    0x313233,
    all has been found in win2000&solaris
    with oracle 8.1.6
    thanks a lot!

    Hello,
    We've got the same problem.
    It comes from the National Character Set of Oracle Database.
    With WE8ISO8859P1, no problem with using this parameters.
    But with WE8ISO8859P9, we have some hexadecimal return.
    I don't know if it's works with another Character set, but with this, It doesn't work.
    We're trying to find a solution. Because change the character set is not one.
    Good luck.

  • Oracle Scrollable ResultSet Chinese Charater Help

     

    I've got the same problems using Sun jdk 1.3.0 and WLS 6.0, with
    Oracle 8.1.6 r2 and thin drivers 8.1.6 from Oracle.
    I've changed to oracle thin drivers version 8.1.7 and
    it works all fine.
    I recommend you to update your drivers to 8.1.7 jdbc thin 2.0
    version.
    Regards
    jsanz
    "Richard" <[email protected]> wrote:

  • Updatable/scrollable java.sql.ResultSet + BC4J + Jdeveloper

    Hi ,
    Can any one help me out how to get Updatable/scrollable ResultSet in bc4j.
    I want to count to total no of row in my application . so i have written below code ,
    dbTrans = this.getDBTransaction();
    PreparedStatement prpmd = dbTrans.createPreparedStatement(query,DBTransaction.DEFAULT);
    ResultSet rst = prpmd.executeQuery();
    if(rst.next())
    if (rst.last())
    totalRecods = rst.getRow()
    but above code give the exception "Invalid operation for forward only resultset : last "

            String sql = "SELECT COUNT(*) FROM table";
            PreparedStatement prest = con.prepareStatement(sql);
            ResultSet rs = prest.executeQuery();
            while (rs.next()){
              records = rs.getInt(1);
            }not sure whether this will be feasible in your case.
    else
    Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE); //creates scrollable resultset
    rs = stmt.executeQuery(sqlString);
    // Point to the last row in resultset.
    rs.last();
    // Get the row position which is also the number of rows in the ResultSet.
    int rowcount = rs.getRow();
    //position to first
    rs.beforeFirst();Note incase of 2nd style if the resultset has huge data then traversing to last will be a time consuming process.
    You can also consider using CachedRowSet http://onjava.com/pub/a/onjava/2004/06/23/cachedrowset.html based on your requirement.

  • Resultset - retrieves all rows or only one at a time

    Hey guys,
    I am using oracle DB. Lets say the query i run has about 1000 records
    when i call:
    prepareStmt(cstmt);
    Rsultset rs = cstmt.executeQuery();
    Do I get all the records, or do i get them one by one
    when i call
    rs.next
    is this DB specific??
    This is simple q, but i been working with oracle and java for a while, and for some reason this never came up.
    thank you.

    The driver implementation is free to retrieve as many or as few rows at a time from the database as it wants. You can suggest to the driver how many rows at a time it should retrieve with setFetchSize(); the driver is free to ignore your suggestion (but many drivers honor it). The fetch size default varies wildly from driver to driver, from 1 row at a time to all rows at a once. For the Oracle thin driver, the default is 10, which is usually too small to give the best performance (I use between 100 and 1,000, usually 250).
    Note that when you're working with a very large ResultSet, a driver that does "all rows at once" can cause you to run out of memory. Also, some drivers will cache every single row when using a scrollable ResultSet (and again run you out of memory) but not do so with a forward-only ResultSet (Oracle has this issue).

  • Array of ResultSets Problem

    hi ,
    esub[i] is an array of scrollable resultsets . where "i" is a premitive integer. When i remove the scrollable and updatable from the corresponding statement object the NullPointerException has gone . But later i need to compare the Resultsets among themselves , for which i need them to be scrollable .
    One more problem is , can i give like this ,
    for(;condition till the whole of array ;)
    while(esub.next()){
    // do something ..
    while(esub[j].next()){
    // do something ...
    esub[j].first();
    esub[i].first();
    please tell me if u understood .I tried this way , but the second while loop i.e, while(esub[j].next()){ // do something } is not getting executed .Why ? Is there any other way of doing it .

    import java.sql.*;
    import java.io.*;
    public class Gra
    Gra(){ }
    public float inputexp(){
                   float exp =0 ;
                   System.out.flush();
         try {
                   BufferedReader bin;
                   bin = new BufferedReader(new InputStreamReader(System.in));
                   exp = Float.parseFloat(bin.readLine().trim());
              } catch(IOException ex) {
                   System.out.println("Caught java.io.IOException:");
                   System.out.println(ex.getMessage());
    return exp;
    public String inputname(){
         String name=null;
              System.out.flush();
         try {
                   BufferedReader bin;
                   bin = new BufferedReader(new InputStreamReader(System.in));
                   name = bin.readLine().trim();
              } catch(IOException ex) {
                   System.out.println("Caught java.io.IOException:");
                   System.out.println(ex.getMessage());
    return name;
    public static void main(String args[]){
    Gra summary = new Gra();
              String url = "jdbc:oracle:thin:@localhost:1521:ORCL";
         Connection con = null;
              try {
              Class.forName("oracle.jdbc.driver.OracleDriver");
              con = DriverManager.getConnection(url,"chandu","chandu");
    System.out.println("Please Enter the Experiment name to compare the subexperiment results ");
    PreparedStatement forsubno = con.prepareStatement("select id,number_of_subexperiments from experiment where name = ? ");
    Statement stmt = con.createStatement();
    Statement sub = con.createStatement();
    Statement explevel = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    forsubno.setString(1,summary.inputname());
    ResultSet expsubinfo = forsubno.executeQuery();
    expsubinfo.next();
    int subnum = expsubinfo.getInt(2);
    String expid = expsubinfo.getString(1);
    int [][] mat = new int [subnum] [subnum];
    ResultSet [] esub = new ResultSet[subnum];
    int i=0;
    ResultSet subid = sub.executeQuery("select id from subexperiment where experiment_id = '"+ expid+"'");
    System.out.println("Enter the lower expression level ----->");
    float low = summary.inputexp();
    System.out.println("Enter the upper expression level ----->");
    float upper = summary.inputexp();
    * Dynamic Resultsets according to the number of the subexperiments present in the given Experiment
    while(subid.next()){
    System.out.println(i);
    System.out.println(subid.getString(1));
    esub[i++] = explevel.executeQuery("select spot_id,expression_level from spotmeasurement where expression_level between "+ low + "and "+ upper + " and subexperiment_id = '" + subid.getString(1) + "'");
    ResultSet rm,rn,rmg,rng;
    * Comparing the Resultsets esub[] among themself for the number of same expressed genes present in common
    for(int m=0;m<subnum;m++){
         for(int n=0;n<subnum;n++){
    if(m!=n){
              while(esub[m].next()){   
    // System.out.println(esub[m].getString(1));
                                                      rm = stmt.executeQuery("select probe_id from spot where id ='"+esub[m].getString(1)+"'");
                                            rm.next();
                        rmg = stmt.executeQuery("select gene_id from geneasprobe where probe_id='"+rm.getString(1)+"'");
                                       rmg.next();
                                                      System.out.println(n);
                                            while(esub[n].next()){ 
         System.out.println(esub[n].getString(1));
                                                 rn = stmt.executeQuery("select probe_id from spot where id ='"+esub[n].getString(1)+"'");
                                                           rn.next();
                                                      rng = stmt.executeQuery("select gene_id from geneasprobe where probe_id='"+rn.getString(1)+"'");
                                                           rng.next();
    if(rmg.getString(1).equals(rng.getString(1))){
                                                                          mat[m][n]=mat[m][n]+1;
                                                                } //end of if
    } //end of inner while
    esub[n].beforeFirst();
                                       } //end of while
                                       esub[m].beforeFirst();
              } //end of if
         } //end of for
    } //end of for
    /** this is for the disply of the result */
    for(int m=0;m<subnum;m++){
    for(int n=0;n<subnum;n++){
              System.out.println(mat[m][n]+"\t");
              System.out.println("\n");
    con.close();
    catch(Exception ex){
                        StringWriter stringWriter = new StringWriter();
                        PrintWriter printWriter = new PrintWriter(stringWriter);
                        ex.printStackTrace(printWriter);
                        StringBuffer error = stringWriter.getBuffer();
                        printWriter.close();
                        System.err.print("Exception:"+ex );
                        System.err.println(ex.getMessage());
                        System.out.println("TRACE = " + error.toString());
    } // end of main
    }// end of Class Gra
    this compiles with out any errors but when executed throws an exception . the error reads as
    Exception:java.lang.NullPointerExceptionnull
    TRACE = java.lang.NullPointerException
    at oracle.jadbc.draver.UpdatableResultSet.next(UpdatableResultSet.java:249)
    at Gra.main(Gra.java:103)
    Can you please tell me whats wrong , If as you say this design is wrong the please suggest me your idea so that let me learn and correct boss.

  • How do I get the number of rows in a ResultSet?

    I checked the API, but didn't find a method that does this.

    You could try calling last() then getRow() to get the
    no of rows ...You probably need a scrollable resultset to do this, so that you can
    rewind back to the start and read the data in.
    I imagine you want to get a count, to size an array, before reading in the data ? Why not load it in an arraylist, then convert to an array afterwards ?
    regards,
    Owen

  • Oracle JDBC Thin Driver Memory leak in scrollable result set

    Hi,
    I am using oracle 8.1.7 with oracle thin jdbc driver (classes12.zip) with jre 1.2.2. When I try to use the scrollable resultset and fetch records with the default fetch size, I run into memory leaks. When the records fetched are large(10000 records) over a period of access I get "outofmemory" error because of the leak. There is no use increasing the heap size as the leak is anyhow there.
    I tried using optimizeit and found there is a huge amout of memory leak for each execution of scrollable resultsets and this memory leak is propotional to the no of records fetched. This memory leak is not released even when i set the resultset,statement objects to null. Also when i use methods like scrollabelresultset.last() this memory leak increases.
    So is this a problem with the driver or i am doing some wrong.
    If some of you can help me with a solution to solve this it would be of help. If needed i can provide some statistics of these memory leaks using optimize it and share the code.
    Thanks
    Rajesh

    This thread is ancient and the original was about the 8.1.7 drivers. Please start a new thread. Be sure to include driver and database versions, stack traces, sample code and why you think there is a memory leak.
    Douglas

  • How to get the row's size of  ResultSet ?

    i can't find a method to return the record number of a ResultSet.
    how can i get it without using the next() method and select count(*) from sometable

    If you use a scrollable ResultSet, you can do something like this:
                   int currRow = rset.getRow();
                   rset.last();
                   int numRows = rset.getRow();
                   if(currRow == 0)
                        rset.beforeFirst();
                   else
                        rset.absolute(currRow);
    [/code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Subset of a ResultSet

    I am trying to optimise my Database code. At step one I make a fetch on the data by getting all the info about all States in my Country table. Now having got a reference to this resultSet, I want to narrow down the ResultSet to contain rows only for the States that the user has selected.
    Can anyone please suggest some way to do this without firing another query to the database.
    I could have done this using a scrollable ResultSet and manipulated the data, but I don't want to. I just want to narrow down the ResultSet dynamically such that the ResultSet I get after narrowing down contains only the data for these states.

    The user is selecting specific states but you are then getting the data for all the states anyways?
    That is inefficient. And misses the point of using a database in the first place.
    But if you must...
    You have to create a loop that goes though all of the data. For each row you compare it to the data you have. If it matches you keep it. If it doesn't you discard it.
    Once done with the loop you return the data you kept.

Maybe you are looking for

  • Siri stopped reading messages...

    Anybody else got this? iOS 8.0 came out and for a brief period I could say 'Hey, Siri' (pause) 'Read Last Message' whilst driving, absolutely brilliant, it meant I didn't have to try to catch it when I heard it come in. Now it just tells me 'You have

  • Calling a footer window in script

    Hi, I want to display some set of records in the footer window. in my footer window iam calling a subroutine program.in that subroutine program iam populating data to an internal table. I want to pass  this internal table data to the footer window by

  • One User - Two Systems

    Is it possible to set up user accounts so that I can use the same user account in both Tiger and Leopard on the same computer? I like Leopard and want to use it as much as possible but Ihave to switch back and forth due to several mail, software and

  • What do you do when you get "the software for ipad was corrupted during download" on ur screen

    please if anyone can help i would be greatful

  • Ipod can't be seen!!!

    I ejected my ipod form i tunes and turned it on to listen to song but I got the error light. I plugged it back on my mac but it's flashing orange and no icon can be seen on my desktop nor on itunes...what's wrong?!? I can't even reset it or restore s