读取 MySQL 连接字符串属性“allowNanAndInf”的值
MySQL 有一个名为 allowNanAndInf
的连接字符串标志。我有一个 java web 应用程序,其连接字符串包含 allowNanAndInf=true
。 allowNanAndInf
连接字符串标志告诉 MySQL 允许双字段中的 NaN
值。
我更改了控制连接字符串的文件并重新启动了服务器,但 MySQL ConnectorJ 仍然不允许双字段中出现 NaN 值。
作为调试步骤,我想打印数据源上 allowNanAndInf
的当前值。我正在使用 hibernate,但我似乎找不到任何有关如何打印 JDBC 连接的连接字符串属性的当前值的文档。有什么想法吗?如何打印连接的 allowNanAndInf
连接字符串标志的当前值?
MySQL has a connection string flag called allowNanAndInf
. I have a java webapp with a connection string containing allowNanAndInf=true
. The allowNanAndInf
connection string flag tells MySQL to permit NaN
values in double fields.
I changed the file that should control the connection string and rebooted my server, but MySQL ConnectorJ still will not permit NaN
values in double fields.
As a debugging step, I would like to printout the current value of allowNanAndInf
on my datasource. I am using hibernate, but I can't seem to find any documentation about how to printout the current value of a connection string property for a JDBC connection. Any ideas? How can I printout the current value of the allowNanAndInf
connection string flag for a connection?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你应该调试你的数据源连接对象,记住Hibernate接收一个连接来处理,我不认为Hibernate有任何调试数据源的实用程序,出于调试目的,你应该尝试使用Driver类中的DriverPropertyInfo集合。
像这样的东西
你可以在这里找到一个很好的例子
http://www .java2s.com/Code/Java/Database-SQL-JDBC/GetDriverPropertyInfo.htm
Your should debug your datasource connection object, remember that Hibernate receives a connection to deal with, I dont think that Hibernate has any utility to debug datasources, for debugging purposes you should try to use DriverPropertyInfo collection from your Driver class.
Something like this
You can find a great example here
http://www.java2s.com/Code/Java/Database-SQL-JDBC/GetDriverPropertyInfo.htm