Behavior change from old to new JDBC driver

Until recently, we had to support a very old MS SQL Server database. To do so, we used a very old JDBC driver. It's filename is sqljdbc4.jar. I'm not 100% sure what JDBC release that is, but I'm guessing it's at least as old as version 6; it could be older. After updating to version 12.4 (latest), most features work correctly. There is one oddity regarding how time(7) data is returned to Ignition.

When querying data in a time(7) column, the old JDBC driver appears to return a string. The new JDBC returns a date (Jan. 1, 1900 + selected time).

I tried adding sendTimeAsDatetime=false to the extra connection properties of the database connection. I also tried setSendTimeAsDatetime=false. Neither of these appeared to change the behavior.

Is there any way to get the old behavior back, or do I need to go through and re-write the application logic to expect a different data type?

Old JDBC behavior:

New JDBC behavior:

Ignition Version: 8.1.17
Java version: 11.0.15+10-LTS

I would argue the way the newer JBDC is doing things is the right way and it's unfortunate your application is expecting dates as a string.

If it's possible I would adjust your application to work with dates. If that's not possible, I would modify the query to cast the date as a string. Those are really your only two options here really if the properties you're adding setSendTimeAsDatetime=false are not doing anything though a little research I can't find an option to do this through the driver. Maybe someone else knows, but imo the ideal thing would make your application work with dates as date objects. Otherwise, you're going to have to CAST each datetime column to a varchar in your queries.

1 Like

I agree. I was hoping for an easy button that would let me push the technical debt to some unspecified future time, but I guess that's not to be.

1 Like