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

Misleading error message during data conversion with H2 database #31

gdemecki opened this issue Nov 7, 2014 · 2 comments

Misleading error message during data conversion with H2 database #31

gdemecki opened this issue Nov 7, 2014 · 2 comments


Copy link

@gdemecki gdemecki commented Nov 7, 2014

Recently I've encountered following stacktrace:

FAILED CONFIGURATION: @BeforeMethod setUpDatabase
com.ninja_squad.dbsetup.DbSetupRuntimeException: org.h2.jdbc.JdbcSQLException: Data conversion error converting "aced0005737200146a6176612e6d6174682e426967496e74656765728cfc9f1fa93bfb1d030006490008626974436f756e744900096269744c656e67746849001366697273744e6f6e7a65726f427974654e756d49000c6c6f776573745365744269744900067369676e756d5b00096d61676e69747564657400025b42787200106a6176612e6c616e672e4e756d62657286ac951d0b94e08b0200007870fffffffffffffffffffffffefffffffe00000001757200025b42acf317f8060854e00200007870000000010378" [22018-182]
    at com.ninja_squad.dbsetup.DbSetup.launch(
    at com.ninja_squad.dbsetup.DbSetupTracker.launchIfNecessary(
    at com.mycompany.mytest.MyServiceBeanTest.setUpDatabase(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(
    at org.testng.internal.MethodInvocationHelper.invokeMethod(
    at org.testng.internal.Invoker.invokeConfigurationMethod(
    at org.testng.internal.Invoker.invokeConfigurations(
    at org.testng.internal.Invoker.invokeMethod(
    at org.testng.internal.Invoker.invokeTestMethod(
    at org.testng.internal.Invoker.invokeTestMethods(
    at org.testng.internal.TestMethodWorker.invokeTestMethods(
    at org.testng.TestRunner.privateRun(
    at org.testng.SuiteRunner.runTest(
    at org.testng.SuiteRunner.runSequentially(
    at org.testng.SuiteRunner.privateRun(
    at org.testng.SuiteRunnerWorker.runSuite(
    at org.testng.TestNG.runSuitesSequentially(
    at org.testng.TestNG.runSuitesLocally(
    at org.testng.remote.RemoteTestNG.initAndRun(
    at org.testng.remote.RemoteTestNG.main(
Caused by: org.h2.jdbc.JdbcSQLException: Data conversion error converting "aced0005737200146a6176612e6d6174682e426967496e74656765728cfc9f1fa93bfb1d030006490008626974436f756e744900096269744c656e67746849001366697273744e6f6e7a65726f427974654e756d49000c6c6f776573745365744269744900067369676e756d5b00096d61676e69747564657400025b42787200106a6176612e6c616e672e4e756d62657286ac951d0b94e08b0200007870fffffffffffffffffffffffefffffffe00000001757200025b42acf317f8060854e00200007870000000010378" [22018-182]
    at org.h2.message.DbException.getJdbcSQLException(
    at org.h2.message.DbException.get(
    at org.h2.value.Value.convertTo(
    at org.h2.jdbc.JdbcPreparedStatement.setObject(
    at com.ninja_squad.dbsetup.bind.Binders$IntegerBinder.bind(
    at com.ninja_squad.dbsetup.operation.Insert.execute(
    at com.ninja_squad.dbsetup.operation.CompositeOperation.execute(
    at com.ninja_squad.dbsetup.DbSetup.launch(
    ... 28 more
Caused by: java.lang.NumberFormatException: For input string: "aced0005737200146a6176612e6d6174682e426967496e74656765728cfc9f1fa93bfb1d030006490008626974436f756e744900096269744c656e67746849001366697273744e6f6e7a65726f427974654e756d49000c6c6f776573745365744269744900067369676e756d5b00096d61676e69747564657400025b42787200106a6176612e6c616e672e4e756d62657286ac951d0b94e08b0200007870fffffffffffffffffffffffefffffffe00000001757200025b42acf317f8060854e00200007870000000010378"
    at java.lang.NumberFormatException.forInputString(
    at java.lang.Long.parseLong(
    at java.lang.Long.parseLong(
    at org.h2.value.Value.convertTo(
    ... 33 more

Steps to reproduce

 drop table buildings if exists;
 create table buildings (id bigint generated by default as identity, name varchar(255) not null, bldgNr bigint, primary key (id));

Key java code snippet:

          .columns("id", "bldgNr", "name")
          .values(1L, "1", "Dormitory No. 1")


I don't know if it Bug with DbSetup or H2 JDBC driver.

Reason of the exception is known to me: exception exists because "bldgNr" is an integer on the database, and I'm inserting "1" string.
When corrected to .values(1L, 1, "Dormitory No. 1") above snippet works fine.
Despite that, I'm reporting this bug because given error message is completely misleading.
Guessing that is because string parameter is decoded internally by the DbSetup, am I correct?

But why above code can't work with H2, while with HSQLDB (hsqldb-2.3.2.jar) under the hood is working just fine?


  • dbsetup version 1.3.0
  • whatever h2 database version
  • OS: Win 7 Enterprise
  • JDK: 1.7.0_51

Tried with:

  • h2-1.3.173.jar as external database
  • h2-1.4.181.jar embedded
  • h2-1.4.182.jar embedded
    but exception is the same.


@jnizet jnizet closed this in 2c38660 Nov 7, 2014
Copy link

@jnizet jnizet commented Nov 7, 2014

H2 doesn't seem to support BigInteger, and the binder for BIGINT column transforms String to BigInteger. Since BigInteger doesn't seem to be officially supported by JDBC, I'll reverse the strategy: BigInteger will be transformed to String. I tested that change with H2, and it seems to work fine that way.
Release 1.3.1 is on its way.
Thanks for this great bug report.

Copy link

@gdemecki gdemecki commented Nov 7, 2014

No :), I thank you for nice library & fast feedback and fix.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.