Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error converting to timestamp / Error converting to array of bytes [JDBC625] #655

Closed
firebird-automations opened this issue Jun 25, 2020 · 4 comments

Comments

@firebird-automations
Copy link

Submitted by: Walter Weinmann (wwe)

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\);
\}
@firebird-automations
Copy link
Author

Commented by: @mrotteveel

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.

@firebird-automations
Copy link
Author

Commented by: Walter Weinmann (wwe)

Sorry - it was my fault - trying to provide the test case showed my problem.

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

No problem. Thanks for letting me know!

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Open [ 1 ] => Closed [ 6 ]

resolution: Cannot Reproduce [ 5 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants