Re: How to set a MySQL TIMESTAMP to null

Fernand Vanrie <[email protected]> Fri, 25 Jun 2010 09:19:51 +0200
Newsgroups gmane.comp.openoffice.dba.devel
Message-ID <[email protected]>
Alex Thurgood wrote:

Is this not a bug in that version (which one, by the way) of the ODBC driver ? I have had this problem for a long time, and it has caused me no end of trouble, for example when I switched to the JDBC driver and it couldn't handle default 0000-00-00 strings. It occurs on my system because I have set the default value of my date fields to be NULL in the create table statement. Even my current MySQL Query Browser client has problems with this and throws an error.

Alex,

I use the native connector, but you are right Date, Time and Timestamps 
are always trouble.

But  as  adviced by Peter  i  will  check for  the  datatype  in the 
Resultset, a technic who most work for all drivers ?

and be carefull to use the correct  update method and thecorrect  SQLtype .

in a prepared statement y wronly used

setString ( 1, 93) 1 is the field and 93 is the Datatype will put 
00-00-00 00:00:00 in thet datbasefield

it has to be

setNull(1,93) set the field to (null)

Greetz

Fernand