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(NumberFormatException.java:
> 48)
> at java.lang.Integer.parseInt(Integer.java:456)
> at java.lang.Integer.parseInt(Integer.java:497)
> at java.sql.Time.valueOf(Time.java:87)
> at
> org.firebirdsql.jdbc.field.FBTimeField.setString(FBTimeField.java:74)
> at
> org.firebirdsql.jdbc.AbstractPreparedStatement.setString(AbstractPreparedS
> tatement.java:383)
> ...
>
> 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.

Roman