Issue Details (XML | Word | Printable)

Key: JDBC-625
Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: Major Major
Assignee: Mark Rotteveel
Reporter: Walter Weinmann
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Jaybird JDBC Driver

Error converting to timestamp / Error converting to array of bytes

Created: 25/Jun/20 08:06 AM   Updated: 26/Jun/20 06:02 PM
Component/s: JDBC driver
Affects Version/s: Jaybird 4.0.0
Fix Version/s: None

Environment: Windows 10


 Description  « Hide
org.firebirdsql.jdbc.field.TypeConversionException: Error converting to timestamp.
        at org.firebirdsql.jdbc.field.FBField.setTimestamp(FBField.java:708)
        at org.firebirdsql.jdbc.AbstractPreparedStatement.setTimestamp(AbstractPreparedStatement.java:306)
        at ch.konnexions.db_seeder.jdbc.AbstractJdbcSeeder.prepStmntInsertColDatetime(AbstractJdbcSeeder.java:831)
        at ch.konnexions.db_seeder.jdbc.AbstractJdbcSeeder.prepDmlStmntInsertCountry(AbstractJdbcSeeder.java:708)
        at ch.konnexions.db_seeder.jdbc.AbstractJdbcSeeder.prepDmlStmntInsert(AbstractJdbcSeeder.java:636)
        at ch.konnexions.db_seeder.jdbc.AbstractJdbcSeeder.createDataInsert(AbstractJdbcSeeder.java:435)
        at ch.konnexions.db_seeder.jdbc.AbstractJdbcSeeder.createData(AbstractJdbcSeeder.java:393)
        at ch.konnexions.db_seeder.jdbc.AbstractJdbcSeeder.createData(AbstractJdbcSeeder.java:328)
        at ch.konnexions.db_seeder.DatabaseSeeder.main(DatabaseSeeder.java:81)

looking into the code:

    public void setTimestamp(Timestamp value) throws SQLException {
        throw new TypeConversionException(FBField.TIMESTAMP_CONVERSION_ERROR);
    }

Same issue with BLOB:

org.firebirdsql.jdbc.field.TypeConversionException: Error converting to array of bytes.
        at org.firebirdsql.jdbc.field.FBField.setBytes(FBField.java:684)
        at org.firebirdsql.jdbc.AbstractPreparedStatement.setBytes(AbstractPreparedStatement.java:224)
        at ch.konnexions.db_seeder.jdbc.AbstractJdbcSeeder.prepStmntInsertColBlob(AbstractJdbcSeeder.java:777)
        at ch.konnexions.db_seeder.jdbc.AbstractJdbcSeeder.prepStmntInsertColBlobOpt(AbstractJdbcSeeder.java:795)
        at ch.konnexions.db_seeder.jdbc.AbstractJdbcSeeder.prepDmlStmntInsertCountry(AbstractJdbcSeeder.java:707)
        at ch.konnexions.db_seeder.jdbc.AbstractJdbcSeeder.prepDmlStmntInsert(AbstractJdbcSeeder.java:636)
        at ch.konnexions.db_seeder.jdbc.AbstractJdbcSeeder.createDataInsert(AbstractJdbcSeeder.java:435)
        at ch.konnexions.db_seeder.jdbc.AbstractJdbcSeeder.createData(AbstractJdbcSeeder.java:393)
        at ch.konnexions.db_seeder.jdbc.AbstractJdbcSeeder.createData(AbstractJdbcSeeder.java:328)
        at ch.konnexions.db_seeder.DatabaseSeeder.main(DatabaseSeeder.java:81)

Code:

    public void setBytes(byte[] value) throws SQLException {
        throw new TypeConversionException(FBField.BYTES_CONVERSION_ERROR);
    }



 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Mark Rotteveel added a comment - 25/Jun/20 09:26 AM - edited
Please provide a minimal reproducible example and make sure to include the actual datatypes you are using in the database. The stacktrace suggests that you aren't inserting into a TIMESTAMP (WITHOUT TIME ZONE), TIMESTAMP WITH TIME ZONE or (VAR)CHAR field for the first stacktrace. For the second stacktrace, the setBytes method is only available on BLOB and (VAR)CHAR types, so likely you are inserting into a different type.

Walter Weinmann added a comment - 26/Jun/20 09:39 AM
Sorry - it was my fault - trying to provide the test case showed my problem.

Mark Rotteveel added a comment - 26/Jun/20 06:02 PM
No problem. Thanks for letting me know!