Hi,
Sorry if it's not the right support channel for this question but I could not find another one which seemed like a better fit.
I'm currently evaluating jooq's professional edition with MS SQL Server. I have a generated table class with the following field:
public final TableField<PassportsRecord, LocalDate> EXPIRY_DATE = createField("EXPIRY_DATE", org.jooq.impl.SQLDataType.LOCALDATE, this, "");
When I try to insert a record with that field set to null I get the following exception:
com.microsoft.sqlserver.jdbc.SQLServerException: Implicit conversion from data type varbinary to date is not allowed. Use the CONVERT function to run this query.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:232)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1672)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:460)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:405)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7535)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2438)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:208)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:183)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.execute(SQLServerPreparedStatement.java:387)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
at org.jooq.tools.jdbc.DefaultPreparedStatement.execute(DefaultPreparedStatement.java:194)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:431)
at org.jooq.impl.AbstractDMLQuery.execute(AbstractDMLQuery.java:335)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:349)
Note that I can successfully insert records into that table as long as I use a non-null value for the aforementioned field.
I tried debugging the issue and ended up in org.jooq.impl.DefaultBinding#set(BindingSetStatementContext<U>) where binding of null values to prepared statements occurs but unfortunately the code handling it for SQLSERVER dialect is closed source.
Am I doing something wrong or is this an issue in jooq I uncovered? Please let me know if I can provide any more information that you might need to answer.
Thanks,
Marcin Erdmann