ResultSet.CONCUR_UPDATABLE Problem

Hi!,
I am using JDK1.3, and in my application i open the statement in updatable mode, while executing it gives me exception as follows
java.sql.SQL.Exception(Option Feature Not Implemented).
To avoid this i download JDBC2.0 Standerd Extension as
jdbc2_0-stdext.jar file from sun.
I added this file in classpath but still it is giving me the same problem.
Tell me the solution for this.

Not every driver implements all methods from the JDBC-interaces.
You should have a look for other drivers for your database.

Similar Messages

  • SQLException JDBC 2.0 ResultSet.CONCUR_UPDATABLE

    Hi, i have a problem using JDBC 2.0, my cod is:
    Statement c = conn.createStatement();
    Statement =conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
    ResultSet rest = n.executeQuery("select * from t_prueba");
    rest.last();
    rest.updateBlob("C", null);
    rest.updateRow();
    rest.close();c.close();conn.close();
    at time to execute this code, i have this error:
    java.sql.SQLException: Operaci�n no v�lida para el juego de resultados de s�lo lectura: updateBlob
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:161)
         at oracle.jdbc.driver.BaseResultSet.updateBlob(BaseResultSet.java:482)
         at oracle.jdbc.driver.OracleResultSet.updateBlob(OracleResultSet.java:1230)
         at mypackage3.Conversor.leerImagenBase64(Conversor.java:51)
         at mypackage3.Conversor.main(Conversor.java:77)
    why is this problem if i using ResultSet.CONCUR_UPDATABLE in my statement.
    i 'm using jdeveloper 10.1.2 whith j2se 1.4.2_04
    please anyone can help me please
    tanks
    alex

    for updateable resultset your query must specify column names to select.

  • Setting ResultSet CONCUR_UPDATABLE

    In SaveLoad class I make a connection to my mysql server;
    by "jdbc:mysql://195.1.215.170:1433/inventory_mapping"
    then I create a Statement;
    DB_Statement = DB_Connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
    after that, I create the resultset for updating my database but
    I could not make the resultset CONCUR_UPDATABLE so it does not update.
    Also I do not use select with * for selecting all the table columns.
    Now the question is; is the problem about mysql or what?
    Note: database server is on my comp. and I connect it as administrator
    and I can delete any row I want but I cannot update.

    You might provide a little information the next time you post a question. Such as how you know you can't update, for one thing. Is your question number 4.5 in the Troubleshooting section of this document which is easily found on the MySQL website?
    http://www.mysql.com/documentation/connector-j/index.html
    If not, post some information about the problem.

  • Exist SQLServer driver implement JDBC20 createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE)?

    Hello,
    I have to perform a kind of "SELECT FOR UPDATE" in a database transaction. My
    DBMS is SQLServer. I think the best approach is to use the createStatement(ResultSet.TYPE_FORWARD_ONLY,
    ResultSet.CONCUR_UPDATABLE) sentence, as this should properly work in other DBMS
    like Oracle as well.
    The problem is that the driver which is provided with WebLogic Server 6.1 beta
    (weblogic.jdbc20.pool.Driver because I am using pools) does not implement this
    sentence. What should I do to get another driver which implements that? Does it
    exist? Do I have to buy it to a third company?
    I have read dozens of messages in this newsgroup regarding JDBC20, but questions
    are usually from Oracle users. I even would not understand how to solve the problem
    if I had Oracle, I think a good explanation about all this mess is missing in
    the Weblogic documentation.
    Any help would be appreciated. Regards,
    David

    David,
    Have a look at the Merant DataDirect drivers.
    Free type 3 and 4 evals are available at www.merant.com/datadirect.
    Cheers,
    Dimitri
    "Sree Bodapati" <[email protected]> wrote in message
    news:[email protected]..
    hi david,
    MS SQL Server driver that ships with WLS does not support JDBC 2.0methods.
    You will have to use a third party driver for this.
    hth
    sree
    "David Ruana" <[email protected]> wrote in message
    news:3b681248$[email protected]..
    Hello,
    I have to perform a kind of "SELECT FOR UPDATE" in a database
    transaction.
    My
    DBMS is SQLServer. I think the best approach is to use thecreateStatement(ResultSet.TYPE_FORWARD_ONLY,
    ResultSet.CONCUR_UPDATABLE) sentence, as this should properly work inother DBMS
    like Oracle as well.
    The problem is that the driver which is provided with WebLogic Server
    6.1
    beta
    (weblogic.jdbc20.pool.Driver because I am using pools) does not
    implement
    this
    sentence. What should I do to get another driver which implements that?Does it
    exist? Do I have to buy it to a third company?
    I have read dozens of messages in this newsgroup regarding JDBC20, butquestions
    are usually from Oracle users. I even would not understand how to solvethe problem
    if I had Oracle, I think a good explanation about all this mess is
    missing
    in
    the Weblogic documentation.
    Any help would be appreciated. Regards,
    David

  • ResultSet.CONCUR_UPDATABLE

    I want to perform a query with the ResultSet.CONCUR_UPDATABLE option, because I want to delete some rows depending on some conditions.
    The problem is that I get no row in the result set, since the first next() invocation returns false.
    But when I perform the same query with just the same SQL sentence without the ResultSet.CONCUR_UPDATABLE option, I get the rows actually matching the WHERE condition.
    Any idea about what I am missing?
    Thanks in advance.

    Nothing at all.
    It has been defined in the CREATE statement as PTOVTA CHAR(20)
    What I can't understand is that the same SQL sentence behaves differently when the Statement instance is created with createStatement() (all columns are recognized without any problem) and when it is created with
    createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE) where it only works if I avoid to refer to that column in the sentence.

  • ResultSet updateRow() problem

    The RDBMS I am working with is:
    Apache Derby version = 10.1.2.1
    I cannot seem to figure out why this ResultSet update is not working.
    I create the ResultSet with the following:
    Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE, ResultSet.HOLD_CURSORS_OVER_COMMIT);The query that I execute to return the result set contains the primary key, FROM contains only one table, and the query contains no JOINS or UNIONS.
    So then I call next()
    Update all the columns that I am interested in updating, up to this point everything is fine, I can get the column that I updated out, and the values are the updated ones.
    When I call updateRow(), I get: Invalid cursor state - no current row
    But there is a current row, I am updating columns in it and those updates are taking place.
    Any help is appreciated.
    Thanks

    yes, it returns true.
    and it is the row that I am interested in. If
    immediately after the next() I get one of the
    columns, it is the correct value, then I set it using
    updateXXX, then get it out again it is the updated
    value. All as I would expect it to work.
    But on the call to updateRow() - Invalid cursor state
    - no current row.Then I would suspect that the database driver you're using doesn't support updateable resultsets (?)
    You do realize that not all databases support that, right?
    Although it would seem that you should get a different error message in that case, hence the (?) above.

  • ResultSet.next() and resultset.islast() problem

    I have query which returns 10 records. I run the using preparedStatement. When i use the while(resultSet.next()), the loop runs untill 10 records and after that when it come to the while check it hangs.
    Sample code
    pstmt= conn.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    rs = pstmt.executeQuery();
    while (rsAccessNoEq.next()) {...
    Then i added the code in the while loop
    if(rs.isLast()){
    return;
    For the first iteration itself the theisLast() is true and it terminates from the loop.
    Please help me

    public class ISP {
         private GFA gestorFic = null;
         private GCA gestorCad = null;
         private GBDAgestor = null;
         private String path = null;
         ServiceProcessVO javaIntra = null;
         ServiceProcessVO javaIntra1 = null;
         ServiceProcessVO javaIntra2 = null;
         ServiceProcessVO javaIntra3 = null;
         ArrayList dataList = null;
         List dataFile = null;
         ArrayList dataList1 = null;
         ArrayList dataList2 = null;
         ArrayList dataList3 = null;          
         public final void iP() throws SQLException,
         MCEA {
         ResultSet rsIntraHq = null;
              Connection connIntraHq = null;
              PreparedStatement pstmtIntraHq = null;
              ResultSet rsIntraFlow = null;
              Connection connIntraFlow = null;
              PreparedStatement pstmtIntraFlow = null;
              ResultSet rsEqNoAccess = null;
              Connection connEqNoAccess = null;
              PreparedStatement pstmtEqNoAccess = null;
              ResultSet rsAccessNoEq = null;
              Connection connAccessNoEq = null;
              PreparedStatement pstmtAccessNoEq = null;
              ResultSet rsFlowHqAccess = null;
              Connection connFlowHqAccess = null;
              PreparedStatement pstmtFlowHqAccess = null;
              dataList = new ArrayList();          
              dataFile = new ArrayList();
              System.out.println("At the begining :"+now() );
              dataFile = gestorFic.leerArchivo(path, file);
              System.out.println("After first step :"+now() );
              int size1 = dataFile.size();
              try {
                   connAccessNoEq = gestor.getConnection();
                   javaIntra = new ServiceProcessVO();
                   pstmtAccessNoEq = connAccessNoEq
                   .prepareStatement(ConsultasAssets.INTRA_ACCESS_NOEQ);
                             //ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
                   pstmtAccessNoEq.setString(1, oti);
                   pstmtAccessNoEq.setString(2, oti);
                   pstmtAccessNoEq.setString(3, oti);
                   rsAccessNoEq = pstmtAccessNoEq.executeQuery();
                   //int k = rsAccessNoEq.TYPE_SCROLL_SENSITIVE;
                   int i = 0;
                   //rsAccessNoEq.last();
                   while (rsAccessNoEq.next()) {
                        i++; System.out.println("Begin of loop:"+i);
                        javaIntra = populatedata(rsAccessNoEq, true);
                        dataList.add(javaIntra);
                        // Flow Hq Access
                        try {
                             connFlowHqAccess = gestor.getConnection();
                             javaIntra1 = new ServiceProcessVO();
                             pstmtFlowHqAccess = connFlowHqAccess
                             .prepareStatement(ConsultasAssets.HQ_ACCESS);
                             pstmtFlowHqAccess.setString(1, javaIntra
                                       .getCTASOCIACION().trim());
                             pstmtFlowHqAccess.setString(2, rsAccessNoEq.getString(1)
                                       .trim());
                             pstmtFlowHqAccess.setString(3, rsAccessNoEq.getString(3)
                                       .trim());
                             pstmtFlowHqAccess.setString(4,oti);
                             pstmtFlowHqAccess.setString(5,oti);
                             pstmtFlowHqAccess.setString(6,oti);
                             rsFlowHqAccess = pstmtFlowHqAccess.executeQuery();
                             while (rsFlowHqAccess.next()) {
                                  javaIntra1 = populatedata(rsFlowHqAccess, false);
                                  dataList.add(javaIntra1);
    //                         if(rsAccessNoEq.isAfterLast()){
    //                              return;
                        } catch (SQLException se) {
                             MCLA.logFatel(ClassNameAssets
                                       .getQualifiedClassName()
                                       + ": "
                                       + ClassNameAssets.getLineNumber()
                                       + ": "
                                       + "Error Occurred in HQ_ACCESS: "
                                       + se.getMessage());
                             throw new MigracionCommonExceptionAssets(se.getMessage());
                        } finally {
                             pstmtFlowHqAccess.close();
                             if (rsFlowHqAccess != null) {
                                  rsFlowHqAccess.close();
                             //gestor.releaseConn(connFlowHqAccess);
         private SPVOpopulatedata(ResultSet rsCpProcess, boolean modify)
         throws SQLException {
              SPVOjavaIntra = new ServiceProcessVO();
              if (rsCpProcess.getString(ConstantesAssets.NU) != null
                        && !rsCpProcess.getString(ConstantesAssets.NU)
                        .equalsIgnoreCase(ConstantesAssets.BLANK))
                   javaIntra.setNU(rsCpProcess.getString(
                             ConstantesAssets.NU).trim());
              if (rsCpProcess.getString(ConstantesAssets.NU_ASO) != null
                        && !rsCpProcess.getString(ConstantesAssets.NU_ASO)
                        .equalsIgnoreCase(ConstantesAssets.BLANK))
                   javaIntra.setNU_ASO(rsCpProcess.getString(
                             ConstantesAssets.NU_ASO).trim());
              // HashTable logic to increament value for CTASOCIACION Start
              if (modify == true) {
                   if (rsCpProcess.getString(ConstantesAssets.CTASOC) != null
                             && !rsCpProcess.getString(ConstantesAssets.CTASOC)
                             .equalsIgnoreCase(ConstantesAssets.BLANK)) {
                        char cha = ConstantesAssets.A;
                        if (tempMap.get(javaIntra.getNU()) != null) {
                             cha = tempMap.get(javaIntra.getNU()).toString()
                             .charAt(0);
                             cha++;
                        tempMap.put(javaIntra.getNU(), Character
                                  .toString(cha));
                        javaIntra.setCTASOCIACION(((rsCpProcess
                                  .getString(ConstantesAssets.CTASOC).trim()) + cha)
                                  .trim());
              } else {
                   javaIntra.setCTASOCIACION(rsCpProcess.getString(
                             ConstantesAssets.CTASOC).trim());
              // HashTable logic to increament value for CTASOCIACION End
              if (rsCpProcess.getString(ConstantesAssets.CCC) != null
                        && !rsCpProcess.getString(ConstantesAssets.CCC)
                        .equalsIgnoreCase(ConstantesAssets.BLANK))
                   javaIntra.setCCC(rsCpProcess.getString(
                             ConstantesAssets.CCC).trim());
              if (rsCpProcess.getString(ConstantesAssets.FIV1) != null
                        && !rsCpProcess.getString(ConstantesAssets.FIV1)
                        .equalsIgnoreCase(ConstantesAssets.BLANK))
                   javaIntra.setFIV(rsCpProcess.getString(
                             ConstantesAssets.FIV1).trim());
              if (rsCpProcess.getString(ConstantesAssets.FFV) != null
                        && !rsCpProcess.getString(ConstantesAssets.FFV)
                        .equalsIgnoreCase(ConstantesAssets.BLANK))
                   javaIntra.setFFV(rsCpProcess.getString(
                             ConstantesAssets.FFV).trim());
              if (rsCpProcess.getString(ConstantesAssets.ES) != null
                        && !rsCpProcess.getString(ConstantesAssets.ES)
                        .equalsIgnoreCase(ConstantesAssets.BLANK))
                   javaIntra.setES(rsCpProcess.getString(
                             ConstantesAssets.ES).trim());
              javaIntra.setI(ConstantesAssets.N);
              javaIntra.setN(ConstantesAssets.BLANK);
              javaIntra.setC(ConstantesAssets.BLANK);
              javaIntra.setCO(ConstantesAssets.BLANK);
              javaIntra.setFI(ConstantesAssets.BLANK);
              return javaIntra;
    Please see the code
    Siva

  • Jdbc ResultSet.next() problem

    this function is part of a class the extends AbstractTableModel
    the line of code that is causing all the problems is right below lines that are indented all the way to the right and are in all caps
    public void setAResultSet(ResultSet results)
    try
    ResultSetMetaData metadata =
    results.getMetaData();
    int columns = metadata.getColumnCount();
    //now we know how many columns there are, so
    //initialize the String array
    columnNames = new String[columns];
    //get the column names
    for(int i = 0; i < columns; i++)
    //remember - columns start with the indice at 1
    columnNames[i] = metadata.getColumnLabel(i+1);
    //get all the rows
    dataRows = new Vector();
    //will store the whole row of data
    String[] oneRow;
    while(results.next());
    //re-allocate memory each time, b/c its a whole
    //new row of data
    oneRow = new String[columns];
    //get the data in the current row, from every
    //column
    for(int i = 0; i < columns; i++)
    {   System.err.println("Indice: " + i);
    PROBLEM ON LINE BELOW
    EXCEPTION STATES "INVALID CURSOR STATE"
    oneRow[i] = results.getString(i+1);
    //all of the data is collected, so store
    dataRows.addElement(oneRow);
    fireTableChanged(null);
    catch(SQLException sqle)
    System.err.println("Error in ResultsModel.setResultSet()");
    System.err.println(sqle.getMessage());
    Anyone has an idea as to why the SQLException is being thrown? Why is the cursor state invalid???

    Hmmmm, try setting the cursor to the first row in the
    result set just before you wish to get the data. That led to some interesting results. Here's what I added:
    while(results.next());
    //re-allocate memory each time, b/c its a whole
    //new row of data
    oneRow = new String[columns];
    boolean texe = results.first();
    THE REST IS THE SAME AS BEFORE
    This also threw a SQLException, with the message: "Result set type is TYPE_FORWARD_ONLY"
    That's very interesting b/c I know that its doing this from iteration 1. I know this because I have an err.println() message in the for loop that's nested in the while loop. That message, which tells me what i equals, did NOT show up. So, going to the first column somehow went backwards causing an error (but I've never had a problem using previous() or any other "backwards" methods for ResultSet objects before!). And where the cursor so going to first() is backwards? Whoever can figure this out deserves Duke Dollars.

  • 100000 records resultset giving problem ?

    Hello All,
    I am using oracle database, windows 2000, OC4J(Oracle Containers for j2ee) Application Server. When I query a emp table which has 100000 records and store the 100000 records in resultset and using a while loop
    if I iterates through the resultset to store each emp record in emp bean array then my application hangs at this point so I am unable to form a emp bean array of 100000 records. What is the reason ?
    Also, I am getting 'OutOfMemoryError' exception at the client side(jsp) when I am trying iterate over a vector that stores each of 100000 emp records as inner vector. I tried to increase my system page file size(virtual memory) to 1GB but this didnt help. So how to avoid this error in windows2000 and on unix box.
    Thanks and Regards,
    Kumar.

    I'd guess the reason is memory related. The simple answer to your question is "don't do that!" Why would the user ever want to look at 100,000 records? If the result of a user request would give such a large number of hits, your app should ask the user to refine the search criteria.
    Even if browsing 100,000 rows really is a requirement (which seems doubtful), why read them all at one pass? You could store a reasonable number (e.g. 1,000) and request a new read every 1,000 records. Alternatively, store the 100,000 in a disk file and page from there.

  • ResultSet.last() problem

    Hi All,
    I am having proble with the ResultSet.last() method.
    The query contains about 25000 records.
    Methods next() and prev() works fine.
    But last() hung.
    The client program is running on different machine from the Oracle database Server.
    Bellow is about what I did.
    ==========================================
    protected Statement stmt = null;
    protected ResultSet rset;
    stmt = conn.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY );
    rset = stmt.executeQuery( "Select * from mytable" );
    rset.setFetchSize( 10 );
    rset.last();
    // Never got here.
    stmt.close();
    conn.close();
    ==========================================
    Any help is appreciated!
    Gwowen

    Here is a possible reason why that would hang:
    To find the "last" record, the database would have to read through all 25,000 records and send them to your program. This would take a long time, since you told it (setFetchSize(10)) to only send 10 records at a time over the network. So perhaps you just didn't wait long enough. Or perhaps something in the network timed out.
    You often see this method posted as a way to find the size of a ResultSet on this forum. However (as you see) it isn't the most efficient in many cases. What you posted is probably your cut-down program -- thank you for not posting 1,000 lines of code -- but an easy way to find the size of that query without actually having to execute it is to execute "Select count(*) from mytable". It returns only 1 row with 1 column, containing the number you want.

  • 10000 records resultset giving problem

    Hello All,
    I am using oracle database, windows 2000, OC4J(Oracle Containers for j2ee) Application Server. When I query a emp table which has 100000 records and store the 100000 records in resultset and using a while loop
    if I iterates through the resultset to store each emp record in emp bean array then my application hangs at this point so I am unable to form a emp bean array of 100000 records. What is the reason ?
    Also, I am getting 'OutOfMemoryError' exception at the client side(jsp) when I am trying iterate over a vector that stores each of 100000 emp records as inner vector. I tried to increase my system page file size(virtual memory) to 1GB but this didnt help. So how to avoid this error in windows2000 and on unix box.
    Thanks and Regards,
    Kumar.

    I agree with all the above posts, you shouldn't never ever try to store 10K or more result objects in memory, let alone generate a web page containing all of those results. Filter it already in the database level, or if you'll showing unfiltered data, give the user a scrollable "window" into the results, just as pretty much every web page does.
    If the data is pretty homogenous, you might even try using a pattern like Flyweight from GoF.
    Anyway, if for some ungodly reason you decide to do it, try increasing the heap size of your JVM with the -Xms and -Xmx parameters. For example java -Xms100m -Xmx512m will set your minimum heap size into 100 megabytes and maximum into 512 megabytes.
    .P.

  • Multiple resultset - strange problem

    Hi,
    I have a stored procedure that returns a single resultset correctly.
    ResultSet rs = cstmt.executeQuery();
    while(rs.next()).......
    Now, I have to change this stored proc, to return multiple resultsets. To test if my code works, I did not change the stored proc(it still returns 1 resultset), but changed my code to -
    boolean results = cstmt.execute();
    System.out.print("do resultsets exist - "+results);
    System.out.print("update count- "+cstmt.getUpdateCount());
    For some strange reason, the boolean value is false! And the updatecount value is 1.
    Can someone pls. explain this? I have the code for retrieving multiple resultsets, but it does not get executed because the initial 'results' value is false.
    Thanks in advance.

    I've never done what you're doing. I do it like this:
            CallableStatement cs = conn.prepareCall("{call PKG_BLAH.MY_FUNCTION(?,?,?)}");
            cs.setLong(1, someKey);
            cs.setString(2, someId's);
            cs.registerOutParameter(3, ORACLECURSORVALUE);
            cs.execute();
            ResultSet rs = (ResultSet) cs.getObject(3);
            while (rs.next()) {
    }

  • Hi resultset.previuos() - problem

    Hi all.
    Im working with jdbc.odbc standart bridge.
    when I try to do resultset.previous() I get an exception taht I cant fetch backwards.
    So I tried to change the statement propertites to somthing like - .TYPE_SCROLL_SENSITIVE
    now I dont get the exceptions but I cant fetch forwards: resultset.next() returns false.
    I also tried to change the direction by calling resultset.setFetchDirection()
    any ideas?
    10x Yonatan

    The jdbc/odbc bridge has known limitations over a pure jdbc driver, this is probably what you're running into. I'd suggest trying to get a hold of a jdbc driver for your database.

  • Assign a field of ResultSet with problem

    Hi all, I'm problems...
    The follow code in JSP executes ok:
    <%
    while (rs.next())
    %>
    <tr><td><%= rs.getString("cod_pro") %> </td></tr>
    <% } %>
    but if I try this ...
    <%
    while (rs.next())
    String cod = rs.getString("cod_pro") ;
    <% } %>
    an SQLException occurs: no data found. Someone can help me ??
    appreciate,
    Andre.

    Hi all, the problem was Microsoft (argh !!) Access doesn's support this command. MySql resolves the problem ... so avoid Access and Microsoft !!!

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

Maybe you are looking for