Hi, I'm wondering if someone has run into this and can
help me understand what's happening.
I'm porting some JDBC code from Another Database to Derby;
I'm using Derby 10.1.1.0 on RedHat Linux.
My program contains a snippet of code something like:
PreparedStatement stmt = conn.prepareStatement(
"insert into my_table (a, b) values (?, ?)");
stmt.setString(1, "1");
stmt.setString(2, "");
stmt.executeUpdate();
Now, it so happens that the second column ('b', above)
is of type INTEGER, and nulls are allowed.
When I run this program in Another Database, what happens
is that the row is inserted, and the value of column 'b'
in the row is set to NULL.
When I run this program in Derby, what happens is that I
get an exception:
org.apache.derby.client.am.SqlException: Invalid character
string format for type INTEGER.
I tried poking around in the JDBC documentation to see what
it said about type conversions, but I got lost, so I thought
I'd ask the Derby list and see what people thought about
this particular behavior.
That is: is it valid for Derby to reject my insert? Or should
it have converted the value to NULL, like Another Database did?
thanks,
bryan
|