You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My local project, we would like to bring p6spy into production because of a datetime issue. JDBC takes Java timestamp and casts it now to a datetime2 field in SQL Server. So we needed ability to cast it. So, we modified ConnectionWrapper.java to call a new file QueryCastingHelper that checks ParameterMetaData for Parameter datetime and modify the ? to a CAST(? AS DATETIME). It would be nice to have a good jdbc driver like p6spy that we can through the flag into the properties file to do it for us instead of having us with a modified version. So can you please provide either functionality to do this casting automatically or be able to have an extra jar in the module directory that has a class callable to do application casting... We modified 6 places in ConnectionWrapper to call QueryCastingHelper to do cast, and then return.
Thank you.
The text was updated successfully, but these errors were encountered:
We added p6Spy to our production servers. We added a NoLogger appender (which got ticket 535).
But since we also upgraded SQL Servers, what JDBC does is for the new SQL Server, it is defaulting datetime automatically to DATETIME2. The change we made to P6SPY was we created a new class called QueryCastingHelper which modified the query and added casting to all the date fields to cast to DATETIME. This class required us to modify ConnectionWrapper in 6 places to call it.
Other people may have this issue if their SQL tables are DATETIME, and JDBC defaults to DATETIME2. p6spy was able to intercept the call and cast back to datetime. My request was to have an option added to spy.properties to cast from datetime2 to datetime, and you have a class that does it.
The reason why we were unable to fix our java code was that we use ibatis/mybatis to call JDBC, and we have no control of the query it creates to add the casting. so p6 does it for us.
Thank you.
Peter
My local project, we would like to bring p6spy into production because of a datetime issue. JDBC takes Java timestamp and casts it now to a datetime2 field in SQL Server. So we needed ability to cast it. So, we modified ConnectionWrapper.java to call a new file QueryCastingHelper that checks ParameterMetaData for Parameter datetime and modify the ? to a CAST(? AS DATETIME). It would be nice to have a good jdbc driver like p6spy that we can through the flag into the properties file to do it for us instead of having us with a modified version. So can you please provide either functionality to do this casting automatically or be able to have an extra jar in the module directory that has a class callable to do application casting... We modified 6 places in ConnectionWrapper to call QueryCastingHelper to do cast, and then return.
Thank you.
The text was updated successfully, but these errors were encountered: