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

Underflow when binding small Double values to Oracle JDBC #7548

Closed
lukaseder opened this issue Jun 6, 2018 · 0 comments
Closed

Underflow when binding small Double values to Oracle JDBC #7548

lukaseder opened this issue Jun 6, 2018 · 0 comments

Comments

@lukaseder
Copy link
Member

lukaseder commented Jun 6, 2018

When binding a java.lang.Double to ojdbc, we shouldn't call PreparedStatement.setDouble(), but OraclePreparedStatement.setBinaryDouble(). Otherwise, some double values cannot be bound to the JDBC driver:

Caused by: java.lang.IllegalArgumentException: Underflow
	at oracle.jdbc.driver.OraclePreparedStatement.setDoubleInternal(OraclePreparedStatement.java:5626)
	at oracle.jdbc.driver.OraclePreparedStatement.setDouble(OraclePreparedStatement.java:5596)
	at oracle.jdbc.driver.OraclePreparedStatementWrapper.setDouble(OraclePreparedStatementWrapper.java:193)
	at org.jooq.tools.jdbc.DefaultPreparedStatement.setDouble(DefaultPreparedStatement.java:143)
	at org.jooq.impl.DefaultBinding$DefaultDoubleBinding.set0(DefaultBinding.java:2092)
	at org.jooq.impl.DefaultBinding$DefaultDoubleBinding.set0(DefaultBinding.java:1)
	at org.jooq.impl.DefaultBinding$AbstractBinding.set(DefaultBinding.java:758)
	at org.jooq.impl.DefaultBindContext.bindValue0(DefaultBindContext.java:62)
	... 43 more

Adaptations:

  • PreparedStatement.setDouble() -> OraclePreparedStatement.setBinaryDouble()
  • PreparedStatement.setFloat() -> OraclePreparedStatement.setBinaryFloat()
  • CallableStatement.registerOutParameter(.., Types.Double) -> registerOutParameter(.., OracleTypes.BINARY_DOUBLE) (101)
  • CallableStatement.registerOutParameter(.., Types.Double) -> registerOutParameter(.., OracleTypes.BINARY_FLOAT) (100)

These work:

  • CallableStatement.getDouble() seems OK
  • CallableStatement.getFloat() seems OK
  • SQLInput.readDouble() seems OK
  • SQLInput.readFloat() seems OK
  • SQLOutput.writeDouble() seems OK
  • SQLOutput.writeFloat() seems OK
  • ResultSet.getDouble() seems OK
  • ResultSet.getFloat() seems OK

See:
https://groups.google.com/forum/#!topic/jooq-user/LCN5zG57FBU

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

1 participant