Thanks a lot for the quick answer, you are right and it is working now, I was a bit blind because I have to adapt code that works with some other dbms'es and I did not expect this change. Thanks again
tom

Bernt M. Johnsen wrote:
I think your answer lies in the description of wasNull()

  boolean wasNull()
                throws SQLException

    Reports whether the last column read had a value of SQL NULL. Note
    that you must first call one of the getter methods on a column to
    try to read its value and then call the method wasNull to see if
    the value read was SQL NULL.

You have not called RS.getXXX() and thus the excpetion is correct.


  
Thomas Vatter wrote (2006-02-22 20:49:59):
                          
I have a problem using ResultSet.getInt() method, each call returns an 
exception:
org.apache.derby.client.am.SqlException: Invalid operation:
wasNull() called with no data retrieved
       at org.apache.derby.client.am.ResultSet.wasNull(Unknown Source)

The code is
       ResultSetMetaData RSMD = RS.getMetaData();
       int INTcols = RSMD.getColumnCount();
       String STRtemp = null;
       while(RS.next())
       {
           String STRvalue = new String();           
           for(int INTcol = 1; INTcol <= INTcols; INTcol++)
           {
               int INTdummy = RSMD.getColumnType(INTcol);              
               switch((int)RSMD.getColumnType(INTcol))
               {
                       if(!RS.wasNull()) // raises exception
                       
{                                                                           

                           STRvalue = "" + 
RSaktuelles.getInt(INTcol);                                              
                       } 
       ...
       }
        }
   }

what can I do to avoid this exception

tom

    

  

-- 
Mit freundlichen Grüßen 
Vatter
 
Network Inventory Software
Sun Microsystems Principal Partner

www.network-inventory.de
Tel. 030-79782510
E-Mail [EMAIL PROTECTED]

Reply via email to