jdbi: Unable to set a null value via JDBI and Sybase JConn4

@SqlCall("{:retVal= exec sp_CountryCredit_Insert :clientID, :country, :user}") OutParameters insertClientCountryCredit(@Bind("clientID") long clientID, @Bind("country") String country, @Bind("user") String user);

when country is bind to NULL, then I’m getting

JZ0SL: Unsupported SQL type 0.

after a closer look, the jdbi is trying to do

statement.setNull(position, Types.NULL);

I override it to

statement.setNull(position, Types.VARCHAR);

and then it seems to work. Is there anything that I’m missing? If not, is it possible to make jdbi smarter to accommodate this situation?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (10 by maintainers)

Most upvoted comments

My latest thinking is to introduce a configuration to Arguments:

public class Arguments implements JdbiConfig<Arguments> {
   ...

  public Arguments setUntypedNullArgument(Argument);

  public Arguments setUntypedNullSqlType(int sqlType) {
    setUntypedNullArgument(new NullArgument(sqlType));
  }
}

Then, in e.g. PostgresPlugin we would call jdbi.getConfig(Arguments.class).setUntypedNullSqlType(Types.OTHER);.