16 messages in com.mysql.lists.javaRe: setting nulls in prepared statement
FromSent OnAttachments
Twibell, Cory L08 Jul 2003 10:26 
Twibell, Cory L09 Jul 2003 07:58 
Pierre Awaragi09 Jul 2003 08:14 
Twibell, Cory L09 Jul 2003 08:18 
col...@dreamwerx.net09 Jul 2003 08:25 
col...@dreamwerx.net09 Jul 2003 08:27 
Pierre Awaragi09 Jul 2003 08:35 
Jeff Mathis09 Jul 2003 08:41 
Twibell, Cory L09 Jul 2003 08:42 
Twibell, Cory L09 Jul 2003 08:46 
Dane Foster09 Jul 2003 08:49 
Marc Slemko09 Jul 2003 09:14 
Keith Hatton09 Jul 2003 09:17 
Paul DuBois09 Jul 2003 09:20 
Twibell, Cory L09 Jul 2003 09:25 
Jeff Mathis09 Jul 2003 09:34 
Subject:Re: setting nulls in prepared statement
From:Jeff Mathis (jmat@predict.com)
Date:07/09/2003 08:41:16 AM
List:com.mysql.lists.java

If you run a query from the mysql command line, I think you'll find that mysql really doesn't allow 'NULL'. It takes on a default value of 0 for ints. varchars look like they can have NULL, but I'm not really sure about this. mysql does not behave like oracle or sybase regarding nulls (i'm not taking a pro or con position on this...)

In any event, we work around this issue. For select statements, I call ResultSet.wasNull() to see if a column really was null.

"Twibell, Cory L" wrote:

Anyone??????

-----Original Message----- From: Twibell, Cory L [mailto:cory@lmco.com] Sent: Tuesday, July 08, 2003 11:27 AM To: 'ja@lists.mysql.com' Subject: setting nulls in prepared statement

All,

Using MySQL4.1.0-alpha, Connect/J3.1 nightly 20030613

Have a table with a varchar and integer as NULL. Using a prepared statement, I can't seem to get "null" into the table. It's currently putting 0 for my integer. I've tried setNull( index, Types.NULL ), setObject( index, null ), setString( index, "null" )....and any combination I can think of.

My prepared statement is built dynamically, with the parameters coming in as a Vector of OBJECTs, so I wont know the data type of the parameter.

Anyone have any suggestions?