That way that H2 works, that's a valid error because the bytestream for the
string "10" is not a valid serialised object.
Why would you want to cast to OTHER?
Lukas Eder wrote:
> Hello,
>
> I've found a little glitch when running the following query:
>
> PreparedStatement s = connection.prepareStatement("select cast(? as
> other)");
> s.setObject(1, "10");
> ResultSet rs = s.executeQuery();
> rs.next();
> System.out.println(rs.getObject(1));
>
> I would expect this to return me the same String "10" again (which is what
> HSQLDB does, for instance). Instead, I get
> the following Stacktrace:
>
> org.h2.jdbc.JdbcSQLException: De-Serialisierung fehlgeschlagen, Grund: {1}
> Deserialization failed, cause: "java.io.EOFException" [90027-163]
> at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
> at org.h2.message.DbException.get(DbException.java:158)
> at org.h2.util.Utils.deserialize(Utils.java:271)
> at
> org.h2.jdbc.JdbcConnection.convertToDefaultObject(JdbcConnection.java:1769)
> at org.h2.jdbc.JdbcResultSet.getObject(JdbcResultSet.java:465)
> at
> org.jooq.test.jOOQAbstractTest.testNamedParams(jOOQAbstractTest.java:9054)
> ...
> Caused by: java.io.EOFException
> at
> java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2280)
> at
> java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2749)
> at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:779)
> at java.io.ObjectInputStream.<init>(ObjectInputStream.java:279)
> at org.h2.util.Utils.deserialize(Utils.java:267)
> ... 29 more
>
> The problem only occurs when using ResultSet.getObject().
> ResultSet.getString() correctly returns "10". I'm not sure,
> if this is a bug or if I have misunderstood something about H2's
> implementation of the "OTHER" data type:
> http://www.h2database.com/html/datatypes.html#other_type
>
> Cheers
> Lukas
> --
> You received this message because you are subscribed to the Google Groups "H2
> Database" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/h2-database/-/bbh98dYZrUMJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.