Hi,

You are calling setObject(....null) and should have called setNull(...)

There is a big difference between Java null (an empty reference) and
SQL NULL (an undefined value).


>>>>>>>>>>>> meenakshi selvi wrote (2006-03-01 05:26:59):
> hi all,
>   i have created a table in derby as follow
>   
> create table sp_ss_ex_contact(
>   email       varchar(200)  primary key,
>    first_name  varchar(50) not null    ,
>    middle_name varchar(50)             ,
>    last_name   varchar(50) not null    ,
>    telephone   varchar(20 )            ,
>    address     varchar(250)            ,
>    state       char   (1  ) not null   ,
>    last_update timestamp not null
> );
>    
>   if any of the rows in the columns middle name,telephone and address is 
> null,it throws the following exception,
>   
> SQL Exception: An attempt was made to get a data value of type 'VARCHAR' from 
> a
> data value of type 'null'.
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown 
> Source)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown 
> Source)
>         at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source
> )
>         at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown 
> So
> urce)
>         at org.apache.derby.impl.jdbc.ConnectionChild.newSQLException(Unknown 
> So
> urce)
>         at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.dataTypeConversion(
> Unknown Source)
>         at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.setObject(Unknown S
> ource)
>    
>   
> please help me.
> 
>                               
> ---------------------------------
>  Jiyo cricket on Yahoo! India cricket
> Yahoo! Messenger Mobile Stay in touch with your buddies all the time.

-- 
Bernt Marius Johnsen, Database Technology Group, 
Staff Engineer, Technical Lead Derby/Java DB
Sun Microsystems, Trondheim, Norway

Attachment: signature.asc
Description: Digital signature

Reply via email to