Subject | Re: PreparedStatements |
---|---|
Author | Nick Sydenham |
Post date | 2004-04-06T14:25:32Z |
--- In Firebird-Java@yahoogroups.com, "Roman Rokytskyy"
<rrokytskyy@a...> wrote:
where parseDate returns a java.sql.Date with the hours, minutes,
seconds and milliseconds set to 0.
I am assuming that with a PS of 'insert into table (f1, f2, f4, f3)
values (?, ?, ?, ?)' that the types are read in the order specified by
the SQL and not the order in which they are specified on the table.
So fields 1, 2 and 4 are varchars, field 3 is a date on the table
defintion. So PS.setDate(4, date) is still correct in theory.
<rrokytskyy@a...> wrote:
> > I'm getting the following error when trying to set an SQL Date in aorg.firebirdsql.jdbc.AbstractPreparedStatement.setDate(AbstractPreparedStatement.java:191)
> > PreparedStatement:
> >
> > org.firebirdsql.jdbc.field.TypeConvertionException: Error converting
> > to date.
> > at org.firebirdsql.jdbc.field.FBField.setDate(FBField.java:744)
> > at
> >
>
> > atcom.atoc.datamig.AuditRecordProcessor.saveRecord(AuditRecordProcessor.java:271)
> >
>
> >ps.setDate(4, parseDate(val));
> > which implies that something is not overriding the setDate method
> > somewhere.
>
> Exactly. Can you provide a test case or describe in details datatypes
> that you have in your query. Note, according to JDBC specs you can
> convert java.sql.Date to java.sql.Timestamp and String. No other
> conversions are possible.
>
> Roman
where parseDate returns a java.sql.Date with the hours, minutes,
seconds and milliseconds set to 0.
I am assuming that with a PS of 'insert into table (f1, f2, f4, f3)
values (?, ?, ?, ?)' that the types are read in the order specified by
the SQL and not the order in which they are specified on the table.
So fields 1, 2 and 4 are varchars, field 3 is a date on the table
defintion. So PS.setDate(4, date) is still correct in theory.