Re: [dba-dev] How to set a MySQL TIMESTAMP to null

2010-06-25 Thread Fernand Vanrie

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 -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


-
To unsubscribe, e-mail: dev-unsubscr...@dba.openoffice.org
For additional commands, e-mail: dev-h...@dba.openoffice.org



Re: [dba-dev] How to set a MySQL TIMESTAMP to null

2010-06-25 Thread Alex Thurgood
Hi Fernand,


>  oStatement.setNull(1, ) for a "textfield" works fine ( =
> long
>  SQLType "others")
>  oStatement.setNull(2, ) for a "timestamp" returns "00-00-00
>  00:00:00" and not the Mysql (null)
> 
>  i tried SQLtype 0 also with same results
> 


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 -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

-
To unsubscribe, e-mail: dev-unsubscr...@dba.openoffice.org
For additional commands, e-mail: dev-h...@dba.openoffice.org