db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manjula G Kutty <manjula.ku...@gmail.com>
Subject Re: SQL Exception
Date Wed, 01 Mar 2006 17:44:24 GMT
meenakshi selvi wrote:

> 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,i t 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 
> <http://us.rd.yahoo.com/mail/in/mailcricket/*http://in.sports.yahoo.com/cricket/>
> Yahoo! Messenger Mobile 
> <http://us.rd.yahoo.com/mail/in/mailmobilemessenger/*http://in.mobile.yahoo.com/new/messenger/>

> Stay in touch with your buddies all the time. 

Hi Meenakshi,
Did you get the exception through ij or through your application 
program? I tried with same schema as yours and everything went well. 
Here is what I did

ij> connect 'jdbc:derby:testdb;create=true';
ij> 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
);
0 rows inserted/updated/deleted
ij> insert into sp_ss_ex_contact 
values('manjula@domain.com','manjula',null,'kutty
',null,null,'a',CURRENT_TIMESTAMP);
1 row inserted/updated/deleted
ij> select * from sp_ss_ex_contact;
EMAIL
                                                |FIRST_NAME
                   |MIDDLE_NAME                                       
|LAST_NAME
                                         |TELEPHONE           |ADDRESS

                               |&|LAST_UPDATE
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
------------------------------------------------------------
manjula@domain.com
                                                |manjula
                   |NULL                                              |kutty
                                         |NULL                |NULL

                               |a|2006-03-01 09:42:03.703

1 row selected


Can you sent me your reproduction script/program?

Thanks
Manjula


Mime
View raw message