just a point i noticed in ure first mail :
u said u get the exception whether or not u check for null or not.
seems to me that the result set may be empty which would give the error :
SQLException : No Data Found
an execution of rs.next() would put it past the end of the resultset if no
resords were retrieved.
Hope this helps
Paul
-----Original Message-----
From: Deepak Patil <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Friday, October 01, 1999 1:03 PM
Subject: how to check whether a column value is null in a database table
>Hi
>
>Keith, I already tried that code but it gives me
>SQLException : No Data Found
>
>I am using JSDK 2.1 and accessing MS-SQL Server Database....
>
>Deepak
>
>
>>From: Keith Ball <[EMAIL PROTECTED]>
>>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
>> Servlet API Technology." <[EMAIL PROTECTED]>
>>To: [EMAIL PROTECTED]
>>To : Deepak
>>
>>Hi.
>>
>>This bit of code works for me......
>>
>>
>>String query = "SELECT * FROM MYTABLE" ;
>>String verytempstring ;
>>
>>ResultSet rs = stmt.executeQuery(query) ;
>>
>>while (rs.next()) {
>> verytempstring = rs.getString("REC_NAME") ;
>> }
>>
>>if(verytempstring == null) {
>> Do some bit of code if it equals NULL ;
>> }
>>
>>
>>Hope this helps...
>>
>>Keith
>>
>>--------------------------------------------------------------------------
-
>>Keith Ball - Praktikant
>>AF12 Operationelle Analysen Luftwaffe
>>IABG MbH Einsteinstr. 20 85521 Ottobrunn
>>Phone : 0049-89-6088-2556
>>Email : [EMAIL PROTECTED] WWW site : www.iabg.de
>>--------------------------------------------------------------------------
--
>>
>>----- Original Message -----
>>From: Deepak Patil <[EMAIL PROTECTED]>
>>To: <[EMAIL PROTECTED]>
>>Sent: Friday, October 01, 1999 10:08 AM
>>Subject: how to check whether a column value is null in a database table
>>
>>
>> > Hi
>> > I am using
>> > rs.getString(1)
>> > for getting a 1st columns value of a database table, I want to check
>>whether
>> > the value is null or not, because if I use it without checking whether
>>it
>>is
>> > null or not it gives me a runtime NullPointerException....
>> >
>> > how can I check for nulity
>> >
>> > Deepak
>> >
>> > ______________________________________________________
>> > Get Your Private, Free Email 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
>> >
>>
>>__________________________________________________________________________
_
>>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 Email 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
___________________________________________________________________________
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