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