Subject Re: [Firebird-Java] setting a Time type PreparedStatement parameter with setString
Author Roman Rokytskyy
> I am using setString on a PreparedStatement's Time type field, where
> the String parameter is 10:20:00.0000
> ex: insertTime.setString(1,"10:20:00.0000");
> The interbase embedded sql guide in "Casting from SQL datatypes to
> datetime datatypes" chapter says "Succeeds it the string is in
> the following format: HH:MM:SS.thou"

The interbase embedded sql guide does not apply here - we are in JDBC world.

> java.lang.NumberFormatException: For input string: "00.0000"
> at
> java.lang.NumberFormatException.forInputString(
> 48)
> at java.lang.Integer.parseInt(
> at java.lang.Integer.parseInt(
> at java.sql.Time.valueOf(
> at
> org.firebirdsql.jdbc.field.FBTimeField.setString(
> at
> org.firebirdsql.jdbc.AbstractPreparedStatement.setString(AbstractPreparedS
> ...
> I don't use setTime, because sometime in the past, that caused a +-1
> hour slip against my program

As you see from stack trace, we use java.sql.Time.valueOf(...) method. So we
need to find reason for +-1 hour slip, since it will happen later too.