I found that although I have created Statement with:
Statement stmnt =
con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ON
LY);
the exception still thrown:
java.sql.SQLException: Scroll sensitive result set is not supported by this
version of the DB2 JDBC 2.0 driver.
I suspect it is not a true JDBC2.0 driver.
I kind managed to test for empty result set by using a boolean flag inside
the WHILE loop, example:
while (rs.next()) {
for (int i = 1; i <= colCnt; i++) {
if (!hasRows) hasRows = true;
System.out.print(" " +
rs.getString(i));
} System.out.println("");
}
The test for null didn't work for me:
> if(aResultSet == null) {
> ...
> }
> Servlet request terminated with Error:
> java.lang.AbstractMethodError: getBigDecimal
>>I suspect you didn't put the driver in the classpath that your
servlet
engine knows about...
I believe I do have the db2java.zip in my classpath, otherwise, I
will get exceptions before the resultset created, e.g. connection or driver
fail, or something... Isn't it?
Thank you. I am much obliged to all your suggestions.
Shirley Kao.
(work) 973-793-5502 (fax) 973-793-5471
email: [EMAIL PROTECTED]
> -----Original Message-----
> From: Papaya Head [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, June 08, 2000 4:14 PM
> To: [EMAIL PROTECTED]
> Subject: Re: How to test if the ResultSet is empty
>
> > > > > java.sql.SQLException: This result set is not scrollable.
>
> so when you create a sql statement, did you also set the resultset
> scrollable? I dunno about JDBC driver for DB2, if it's JDBC20 standard,
> when
> you call createStatement, you need also to specify whether the result set
> is
> scrollable, for example:
>
> con.createStatement(ResultSet.TYPE_SCROLLSENSITIVE,
> ResultSet.CONCUR_UPDATABLE);
>
> if you don't specify these attributes, createStatement only creates a
> JDBC1.0 type statement which is not scrollable...
>
> > > > > Servlet request terminated with Error:
> > > > > java.lang.AbstractMethodError: getBigDecimal
>
> I suspect you didn't put the driver in the classpath that your servlet
> engine knows about...
>
> >From: John Hicks <[EMAIL PROTECTED]>
> >
> >Works with the JDBC driver that ships with DB2 5.x or 6.x (among others):
> >
> > //get rows
> > sql = dbConn.createStatement();
> > sql.execute( dbCall );
> > aResultSet = sql.getResultSet();
> >
> > //or was this an update?
> > if(aResultSet == null) {
> > ...
> > }
> >
> > //get column SQL data types
> > rMetaData = aResultSet.getMetaData();
> > columnCount = rMetaData.getColumnCount();
> > columnCount++; // because first column is 1, not 0
> >
> > while( aResultSet.next() ) {
> > ...
> > }
> >
> >John Hicks
> >ceriumworks.com
> >XMLOutline XMLdb XMLServlet
> >
> >-----Original Message-----
> >From: A mailing list for discussion about Sun Microsystem's Java Servlet
> >API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Kao,
> >Shirley (Exchange)
> >Sent: Thursday, June 08, 2000 12:57 PM
> >To: [EMAIL PROTECTED]
> >Subject: Re: How to test if the ResultSet is empty
> >
> >
> >Thank you so much for both of your inputs. Does anyone knows what link
> >allows me to obtain the DB2 Driver which has JDBC2.0? I guess I need to
> >look into IBM site. It would be a great help if some of you know the
> >specific link.
> >
> >Also, if I am unable to get a newer db2 driver, can I use existing jdk
> >1.2.2/jdbc1.0 driver, and with it which can test for empty resultset? I
> >did
> >some research and only know the usage of while loop with rs.next()
> method,
> >but it can not be used in conjunction of a if statement. With IF
> statement
> >call before WHILE, the cursor would move to the first row if data row is
> >present, and the next while loop call would skip the first row. Am I
> >overlook or misunderstood these usage's?
> >
> >Your insights would be greatly appreciated.
> >
> >Thanks
> >Shirley Kao
> > > Bear Stearns Inc
> >(work) 973-793-5502 (fax) 973-793-5471
> >email: [EMAIL PROTECTED]
> >
> > > -----Original Message-----
> > > From: Papaya Head [SMTP:[EMAIL PROTECTED]]
> > > Sent: Thursday, June 08, 2000 11:33 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: How to test if the ResultSet is empty
> > >
> > > I agree that Shirley needs a JDBC driver which implements the
> interfaces
> > > provided by JDK1.2. but it should be a DB2 driver, not an Oracle
> >driver:)
> > >
> > > >From: Daljit Singh Dhillon <[EMAIL PROTECTED]>
> > > >Hello,
> > > >
> > > >Actually what you need is a database driver that recognises and
> > > implements
> > > >the APIs for JDBC 1.2, For oracle yuo can download it from
> > > >technet.oracle.com. Just download it and put it in the accessible
> > > >classpath.
> > > >I think that should do the needful.
> > > >
> > > >=======================
> > > > It's never too late to begin
> > > >=======================
> > > >----- Original Message -----
> > > >From: Kao, Shirley (Exchange) <[EMAIL PROTECTED]>
> > > >To: <[EMAIL PROTECTED]>
> > > >Sent: Thursday, June 08, 2000 4:31 AM
> > > >Subject: How to test if the ResultSet is empty
> > > >
> > > >
> > > > > I am using IBM Visual Age v3.0 which I believe it has JDBC2.0
> >because
> > > it
> > > > > allows me to use all of new scrollable methods in jdbc v2.0, and
> > > >compiled
> > > > > without errors, but only when I execute my testing servlet I
> receive
> > > >this
> > > > > error:
> > > > >
> > > > > java.sql.SQLException: This result set is not scrollable.
> > > > >
> > > > > I sent sql to a DB2 application, is DB2 has to be in compliance
> with
> > > the
> > > >new
> > > > > features? I have included db2java.zip in my classpath, but not
> sure
> > > if
> > > > > there is a newer version of zip file for jdbc2.0.
> > > > >
> > > > > I'd like to use getRow() or the likes to determine if result set
> is
> > > >null.
> > > > > How can I achieve it?
> > > > >
> > > > > The second question I have is an error:
> > > > >
> > > > > Servlet request terminated with Error:
> > > > > java.lang.AbstractMethodError: getBigDecimal
> > > > >
> > > > > which is thrown when I call the rs.getBigDecimal(columnIndex), it
> > > should
> > > >be
> > > > > java.sql.* kind exceptions, shouldn't it?
> > > > >
> > > > > Any of your help and suggestion would be greatly appreciated.
> > > > >
> > > > > Thanks.
> > > > > Shirley Kao
> > > > >
> > > > >
> > > > >
> > >
> ________________________________________________________________________
> > > Get Your Private, Free E-mail from MSN Hotmail at
> http://www.hotmail.com
> > >
> > >
> >_________________________________________________________________________
> _
> > > _
> > > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> > > body
> > > of the message "signoff SERVLET-INTEREST".
> > >
> > > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > > Resources:
> http://java.sun.com/products/servlet/external-resources.html
> > > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
> >
> >***********************************************************************
> >Bear Stearns is not responsible for any recommendation, solicitation,
> >offer or agreement or any information about any transaction, customer
> >account or account activity contained in this communication.
> >***********************************************************************
> >
> >_________________________________________________________________________
> __
> >To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> >of the message "signoff SERVLET-INTEREST".
> >
> >Archives: http://archives.java.sun.com/archives/servlet-interest.html
> >Resources: http://java.sun.com/products/servlet/external-resources.html
> >LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
> >_________________________________________________________________________
> __
> >To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> >of the message "signoff SERVLET-INTEREST".
> >
> >Archives: http://archives.java.sun.com/archives/servlet-interest.html
> >Resources: http://java.sun.com/products/servlet/external-resources.html
> >LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
> __________________________________________________________________________
> _
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html