Subject | Re: PreparedStatements |
---|---|
Author | Nick Sydenham |
Post date | 2004-04-06T13:49:21Z |
I'm getting the following error when trying to set an SQL Date in a
PreparedStatement:
org.firebirdsql.jdbc.field.TypeConvertionException: Error converting
to date.
at org.firebirdsql.jdbc.field.FBField.setDate(FBField.java:744)
at
org.firebirdsql.jdbc.AbstractPreparedStatement.setDate(AbstractPreparedStatement.java:191)
at
com.atoc.datamig.AuditRecordProcessor.saveRecord(AuditRecordProcessor.java:271)
which implies that something is not overriding the setDate method
somewhere.
--- In Firebird-Java@yahoogroups.com, "Roman Rokytskyy"
<rrokytskyy@a...> wrote:
PreparedStatement:
org.firebirdsql.jdbc.field.TypeConvertionException: Error converting
to date.
at org.firebirdsql.jdbc.field.FBField.setDate(FBField.java:744)
at
org.firebirdsql.jdbc.AbstractPreparedStatement.setDate(AbstractPreparedStatement.java:191)
at
com.atoc.datamig.AuditRecordProcessor.saveRecord(AuditRecordProcessor.java:271)
which implies that something is not overriding the setDate method
somewhere.
--- In Firebird-Java@yahoogroups.com, "Roman Rokytskyy"
<rrokytskyy@a...> wrote:
> > It seems that PreparedStatements are not supported in JayBird as the
> > source for FBField.java shows the following for all set methods:
> >
> > public void setDate(Date value, Calendar cal) throws SQLException
> > {
> > throw (SQLException)createException(
> > DATE_CONVERSION_ERROR).fillInStackTrace();
> > }
> >
> >
> > The release notes say that PreparedStatements are working. What's
> > the truth?
>
> Your understanding of sources is wrong. If you check FBField
> modifiers, you will see that class is abstract. You simply cannot
> instantiate it. When you check AbstractPreparedStatement and
> FBField.createField() method, you will see that it uses FBField
> subclasses, which implement only methods that are relevant for the
> particular data type. For possible conversion, see JDBC specification
> (somewhere in appendix, probably appendix B).
>
> So, PreparedStatement is fully supported as well as
> CallableStatement. Version from CVS passes most of JDBC CTS suite
> (only tests that are not relevant for Firebird were excluded).
>
> Roman