J. Insi wrote:well, ya ... I mean, the table of that mysql is already assigned using DEFAULT value.
Such as its values from :
I already set them with : "-" as the default value.
But, here the case is... what String value that I need to pass upon
the values of :
Because, If I pass null or empty string (" ") into the setString as below ;
it won't pass the default value... even If, let say I one of them become NULL, and it's set...
still, the query passing over the values not the DEFAULT.
~ correct me if i'm wrong.
It is normal for
Java J2EE applications, if you set them with empty strings then those columns will store empty string value inside the columns defined.
Firstly,
you should check the value in your Java code and validate the getString method for NULL or empty strings. Validation inside Java Code is required if you don't want to set (empty or NULL).
You should decide by using simple if/else logic and checking NULL or empty string. After checking values you can use setString method for those columns with DEFAULT like below;
INSERT table VALUES (DEFAULT, NULL, 'WA', DEFAULT,.....) I mean use setString method like this setString(1,'DEFAULT')
If you use setString method, naturally it will change(override) the default value.
Otherwise how can you set NULL or empty string for those colums??? That's case. ? got it ?
Tuna TÖRE