Re: nulls in sql and jdbc - Mailing list pgsql-jdbc

From Marcin Jekot
Subject Re: nulls in sql and jdbc
Date
Msg-id 1066639571.1635.19.camel@localhost.localdomain
Whole thread Raw
In response to nulls in sql and jdbc  (J Joubert <cs344@joubert.me.uk>)
List pgsql-jdbc
use prepStmt.setNull("columnName");

and Stirng str = resultSet.getString("columnName");

if (resultSet.wasNull()) { }

http://java.sun.com/j2se/1.4.2/docs/api/ look under the java.sql
package.

Regards
Marcin Jekot

On Sun, 2003-10-19 at 14:43, J Joubert wrote:
> How exactly do I use nulls in sql and java?
>
> What I mean is, when I want a column in my database to be set to null, can I
> just use
>   prepStmt.setString(1, null)
> and would this work for setting columns of any type?
>
> Conversely, for reading values in that are a null in sql, could I for example
> say
>   String str = resltSet.getString("columnName");
>   if (str.equals(null))
>   {
>     ....
>   }
> and again, is this valid for any type in java or sql?
>
>
>
> _______________________________________________________________________
> All the good things in life are either illegal, immoral or fattening.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org
>


pgsql-jdbc by date:

Previous
From: J Joubert
Date:
Subject: nulls in sql and jdbc
Next
From: "Serguei Mokhov"
Date:
Subject: Russian NLS update: errors_ru.properties