Scrollable/Read_only  ResultSet objects

I am trying to create an instance of a scrollable/read_only ResultSet object with the following code:
Statement stmt = con.createStatement(
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery("SELECT * FROM ...");
The Connection object has been made successfully but am getting an AbstractMethodError Exception at line 1.
Can anyone please help me out here.
Thank you.

I don't believe the Oracle driver allows for
read/only. I'll take a look at the Oracle website,
and see if I can verify that.
JoelSorry, I was wrong on this. From the Oracle JDBC documentation, it states that CONCUR_READ_ONLY is valid for the Oracle 8 and Oracle 9 drivers. Are you using classes12.zip or classes12.jar for your Oracle libraries?

Similar Messages

  • Scrollable/Updateable ResultSet objects

    I am trying to create an instance of a scrollable/updateable ResultSet object with the following code:
    Statement stmt = con.createStatement(
    ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    ResultSet rs = stmt.executeQuery("SELECT * FROM sch.a");
    The Connection object has been made successfully but am getting an AbstractMethodError Exception at line 1.
    Can anyone please help me out here.
    Thanks
    I am using JDK 1.3.1 and JDBC 2.0

    I use this and works fine for me....let me know how it goes...
    ResultSet resultSetMultCond = null;
    Statement getMultPartCond = null;
    String sqlMultCond = null;
    sqlMultCond = "SELECT #PART,#CONDS,COUNT(*) AS MCOUNT FROM MYLIB WHERE #PART = 'A123' GROUP BY #PART,#CONDS ORDER BY #PART";
    getMultPartCond = conn.createStatement(java.sql.ResultSet.TYPE_SCROLL_SENSITIVE,java.sql.ResultSet.CONCUR_UPDATABLE);
    resultSetMultCond = getMultPartCond.executeQuery(sqlMultCond);

  • Getting size of ResultSet Object

    Is there any effective way to retrieve the size of ResultSet object while the type of the ResultSet itself is a default one (TYPE_FORWARD_ONLY) ?

    Maybe I was a little harsh ...or lazy to type anything. I don't think there are any efficient ways to count the number of rows in a ResultSet(for scrollable, forward only, etc)
    You could do the following:
    rs= statement.executeQuery("select count(column1) from table1 where column1<100");
    rs.next();
    long recordCount = rs.getLong(1);
    before executing your real query
    rs = statement.executeQuery("select column1 from table1 where column1<100");
    while rs.next.....
    Jamie

  • Two resultset objects

    IS it possible to define two resultset objects with two different queries inside the same DB class?java.sql.SQLException: Invalid state, the ResultSet object is closed.
         at net.sourceforge.jtds.jdbc.JtdsResultSet.checkOpen(JtdsResultSet.java:299)
         at net.sourceforge.jtds.jdbc.MSCursorResultSet.next(MSCursorResultSet.java:1123)
         at DB5.getDetails(Daily_Quote_Response_report.java:238)
         at Daily_Quote_Response_report.main(Daily_Quote_Response_report.java:74)
    java.util.List items = null;
            String query;
            String query2;
            try {
                query =
                       "select * from oqrep_except_resp_summary";
                query2 = "select * from oqrep_except_resp_detail";
                Statement state = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_READ_ONLY);
                ResultSet rs = state.executeQuery(query);
                ResultSet rs2 = state.executeQuery(query2);
              //cannot create two rs objects // ResultSet rs2 = state.executeQuery(query);
                items = new ArrayList();Edited by: bobz on 03-Dec-2009 11:16
    Edited by: bobz on 03-Dec-2009 11:16

    Note: This thread was originally posted in the [Java Programming|http://forums.sun.com/forum.jspa?forumID=31] forum, but moved to this forum for closer topic alignment.

  • Using all types of resultset Objects i need a single program

    i think all of u know that there are 8 types of resultset objects are there in jdbc technology i.e
    # next() - moves the cursor forward one row. Returns true if the cursor is now positioned on a row and false if the cursor is positioned after the last row.
    # previous() - moves the cursor backwards one row. Returns true if the cursor is now positioned on a row and false if the cursor is positioned before the first row.
    # first() - moves the cursor to the first row in the ResultSet object. Returns true if the cursor is now positioned on the first row and false if the ResultSet object
    does not contain any rows.
    # last() - moves the cursor to the last row in the ResultSet object. Returns true if the cursor is now positioned on the last row and false if the ResultSet object
    does not contain any rows.
    # beforeFirst() - positions the cursor at the start of the ResultSet object, before the first row. If the ResultSet object does not contain any rows, this method has
    no effect.
    # afterLast() - positions the cursor at the end of the ResultSet object, after the last row. If the ResultSet object does not contain any rows, this method has no effect.
    # relative(int rows) - moves the cursor relative to its current position.
    # absolute(int n) - positions the cursor on the n-th row of the ResultSet object.
    Using all these result set methods i need a sample program all these methods must be used in a single program itself

    BalajiEnntech123 wrote:
    i think all of u know that there are 8 types of resultset objects are there in jdbc technology i.e I don't know who "u" are but they're wrong if they think there are "8 types of resultset objects are there in jdbc technology".
    They'd be especially wrong to think that the methods you mention are "types of resultset objects".

  • Can i open more than one Resultset object

    hi in my program i have to retrive data from three table and the data from three
    table i have to use in another one
    i wanna know that can we open more than one ResultSet object within one
    try{
    }catch{] block ( i means ResultSet rs = st.excuteQuery(query) more than one time for different -different tables)
    or there is any other way to do this

    You can only have one active result set per statement at a time.
    Depending on the driver you are using you might be able to have more than one active statement (and result set) on one connection. Or not.
    Try catch has nothing to do with that.
    If you are nesting result sets then it is likely you should be using a join (SQL) which would then only require one result set.

  • How to set the fetch size for a ResultSet object?

    Connection con  = getConnection();
    Statement stmt = con.createConnection();
    ResultSet res = stmt.executeQuery("select * from table");
    //res.setFetchSize(?);
    while (res.next)
    res.get....
    }I do not know the number of rows .
    How can I set the fetch size for the ResultSet object?
    I try
    res.last();
    res.setFetchSize(res.getRow()/2);
    res.beforeFirst();
    while (res.next)
    res.get....
    }but it's so slow if there are 6000 rows.
    How can I set the fetch size for the ResultSet object more effectible?
    And what is the best number to set the fetch size?

    The fetch size defaults to a standard number. It is unlikely that it will be any faster if you set it unless you only plan to read a small number of rows.
    i.e. if you are going to read all the rows, you need to read all the rows no matter what.
    Unless the system has set the fetch size to 1 changing it will not be faster.
    Depending on the row length, reading in 6000 rows is going to take a long time. You could try using a cpu profiler to improve performance.
    Do you really need to read everything in every row?

  • Deep Cloning of resultset object

    Hi, Is it possinble? Deep Cloning of resultset object?
    Resltset rs = pstmt.execute()
    Anyway to assign rs2 = rs1
    Because I am passing my resulset to a legacy application's method, that does a rs.close(). I need to use the same resultset later. JDK 1.4

    Write a dynamic proxy to the ResultSet where theclose() method does >nothing.
    What if the OP discovers that the app does a rs=null
    as well?How can that affect your code? Presumably the ResultSet is passed as an argument to a legacy method so the legacy method might set it's local reference to null it will not affect the reference held by the caller of the method.
    The op then runs thru hoops to get permission to
    modify a line in legacy code and is too distressed to
    post.He does not need to! You need to learn about Java argument passing.
    Anyway, thanks for the classrom solution. but i cant
    create another class file for extending rs.You have not presented any reason why not! This can be an inner class in the code you are writing and has no influence what so ever on the legacy application.
    >
    If you are too distressed by the posts here, you are
    under no obligation to reply to every one. Anyway , i
    found the postI replied because I had a viable solution to a problem you were having. Nothing you have said so far stops it being viable. Look at my posting history - I do not try to reply to everyone.
    >
    A Resultset is mainly a Java front end for adatabase
    cursor (which exists on the database server). When
    the ResultSet is closed, the cursor will be closed
    too so, even if you could copy everything in the
    ResultSet object, the handle for the cursor wouldno
    longer be valid.
    Which is why you use a Proxy so that you can control exactly what happens.
    >>
    To truely "deep copy" a resultset the depth would
    have to extend accros the database connection to
    cloning the cursor.I still don't see why you need to clone the ResultSet rather than use a proxy!
    >
    very much useful than the self pity expressed by
    you.No self pity! I just expressed annoyance at the lack of feedback from you and many others.
    No offence, none taken and none dealt.I still find it offensive when people don't bother with a simple acknowledgement. I don't ask many questions myself but when I do I make sure I track the responses and acknowledge those who try to help.
    I still think you should re-think your solution but you are free to totally ignore my very simple solution. I expect you will ignore it so the best of luck.

  • How to store a DB row (multiple columns) from ResultSet object to hm/ht

    I am trying to store a DB row (which is containing ~150+ columns) from ResultSet Object to HashMap/Hashtable using the below code. But I wonder is, this not working and even do not get any error.
    dataslotHashmap.put(rsmd.getColumnName(i+1),rs.getObject(i+1));
    where "rsmd" ResultSetMetaData Object and "rs" is ResultSet Object.
    Need advice please

    Code snippet for reference:
    rs=stmt.executeQuery("select * from ......
    rsmd=rs.getMetaData();
    rs.next();
    int noc=rsmd.getColumnCount();
    for(int i=0;i<noc;i+=1) {
    dataslotHashmap.put(rsmd.getColumnName(i+1),rs.getObject(i+1));

  • How to return ResultSet object from Bean to JSP

    I have a Java Bean, in it I have ResultSet Object in a method. Now I want to send this ResultSet Object to the JSP.

    very good advice, otherwise you will spread your sql exception handling over way too many places. Keep it centered, so you can be sure to close your connection, statement, resultset again. Otherwise your database and web application might all of a sudden stop responding.

  • What is rs.getFetchSize() where rs is ResultSet object

    I am trying to figure out how to know the number of rows my query returned.. I didn't find any function in ResultSet Except getFetchSize() but it lways returns 1. Can someone help me out.
    Thanks a lot

    you can do this with SQL using COUNT or in the result set through java through some tricks. this question has been asked repeatedly before. i suggest you read some of these...
    http://forum.java.sun.com/thread.jsp?forum=48&thread=83958
    http://forum.java.sun.com/thread.jsp?forum=48&thread=89968
    or browse through the search i just did on count number of rows returned
    http://search.java.sun.com/search/java/index.jsp?col=javaforums&qp=%2Bforum%3A48&qt=count+number+of+rows+returned
    the getFetchSize and it's complement setFetchSize is way for you to give performance hints to the driver on how much data it should read/hold/cache at one time.
    from the API
    Gives the JDBC driver a hint as to the number of rows that should be
    fetched from the database when more rows are needed for this ResultSet
    object.

  • Oracle Function returns a Ref Cursor to a ResultSet object - Performance

    My program calls an Oracle PL/SQL function which returns a ref cursor to a ResultSet object. I know that the function runs to completion relatively quickly when i run it in an anonymous block but when the call is made through my Java application the resultset takes about 30 mins to return. Below is a snippet of my code:
    currentConnection = ConnectionManager.getInstance().getConnection();
    reportStmt = currentConnection.prepareCall("BEGIN ? := ENVISION.PKG_WMS_TO_AP.F_REPORT_CI_SC_HOLDING(?,?); END;"); reportStmt.registerOutParameter(1, OracleTypes.CURSOR);
    reportStmt.setString(2, invoice.getCrewHQ());
    reportStmt.setDate(3, invoice.getWrCompletionDate());
    reportStmt.execute();
    reportRS = ((OracleCallableStatement) reportStmt).getCursor(1);
    Through a debugger I see that the second last statement (reportStmt.execute()) runs quickly. It is only when I step into the last statement that the debugger takes up to 30 minutes.
    Any thoughts?

    Flynn,
    The Internet is a dynamic place. After nearly two and a half years, there is a chance that a link will change. This is the new URL for the relevant Web page:
    http://asktom.oracle.com/~tkyte/ResultSets/
    Good Luck,
    Avi.

  • Send a ResultSet object via RMI - won't work.

    Hi. I make a user interface to access MySQL database. The access to MySQL server is done from a remote location via RMI. The process to delete/update/create was succeed. The only problem is when I try to get(from the client computer) the ResultSet object, that come from invoking statementObject.executeQuery(myQuery) method, from the server Computer: it won't work. It said that the ResultSet object is not serialized(it is an interface). I need the ResultSet object for my client program since I will use it to set my AbstractTableModel class's object. Last goal is to put the AbstractTableModel object into the JTable constructor so I can see the result from a table.
    Is anyone can help me? I can not return the ResultSet object to the client since it is not serialized.

    I use the following solution using List. As List is Serlizable I can throw it across the network using RMI... it is also of course easy to access.......
    For users objects you need to throw across the network just simply make them implement Serializable
    In your ORM class accessing the DB:
    public List getSQLResults{
    Resultset SQLResults = statement.executeQuery(SQLQuery);
    Vector results = new Vector();
    while (SQLResults.next()){
    // create class object here if needed...
    results.add(SQLResults.getStrinf("COL_NAME");
    return results;In your GUI class..
    JTable theTable = new JTable();
    DefaultTableModel theModel = new DefaultTableModel();
    theModel.addColumn(SOME_COLUMN);
    try{
    List resultsData = ORMClass.getSQLResults();
    Iterator iterator = List.Iterator();
    while(iterator.hasNext()){
    iterator.next();
    theTableModel.addRow(SOME_OBJECT);
    theTable.setModel(theModel);
    catch(Exception ex){
    // exception rasied...... do something!!!
    }

  • Resultset Object

    can any one out there please tell me about how to retrive resultset object through RMI as resultset is not serializable? or should i have to do somthing other than RMI. (which actually i don't want to)

    You cannot send a ResultSet object through RMI, as you
    found out. But don't give up on RMI. Design your own
    object to hold your data, then read through the result
    set on the server and put the data into your new
    custom object. Make sure that's serializable, then
    you can send it through RMI.

  • 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.

Maybe you are looking for

  • Discoverer Report Names

    Discoverer Report Naming Our service Provider has created lot many reports for us and now theres a need for a generic naming to be followed for the Discoverer reports. Could someone tell me how difficult it would be to rename all the reports? As I co

  • X200 does not turn on

    Problem: Laptop tries to turns on only when battery is inserted, but only LEDs flash once. When battery is removed, laptop does not trying to turns on, and the LED 'AC power status' does not illuminate (but it must illuminates) This happend when I re

  • Homesharing won't drag and drop songs onto a shared library

    Homesharing won't drag and drop songs onto a shared library. Both computers are authorized and both have "homesharing" turned on. Any help?

  • Pass details into Custom Element

    Hi, I've begun to create a Custom Element which I have based off of the Flash example that comes with the Ravenna Hosting example site. My Custom Element creates and passes back some HTML just as the Flash example but I need this HTML to be editable

  • I've experience a concerning problem on Macintosh Mail

    CONCERNING PROBLEM #1 I have sent sensitive emails that were received by the intended recipient, but were also by an unintended recipient. It appears the unintended recipient intentionally made this happen in a pre-meditated manner by using receive C