读取 MySQL 连接字符串属性“allowNanAndInf”的值

发布于 2024-12-22 04:40:24 字数 427 浏览 2 评论 0原文

MySQL 有一个名为 allowNanAndInf 的连接字符串标志。我有一个 java web 应用程序,其连接字符串包含 allowNanAndInf=trueallowNanAndInf 连接字符串标志告诉 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

五里雾 2024-12-29 04:40:24

你应该调试你的数据源连接对象,记住Hibernate接收一个连接来处理,我不认为Hibernate有任何调试数据源的实用程序,出于调试目的,你应该尝试使用Driver类中的DriverPropertyInfo集合。

像这样的东西

DriverPropertyInfo[] attrs = driver.getPropertyInfo("jdbc:mysql://localhost/mydb", props);

你可以在这里找到一个很好的例子

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

DriverPropertyInfo[] attrs = driver.getPropertyInfo("jdbc:mysql://localhost/mydb", props);

You can find a great example here

http://www.java2s.com/Code/Java/Database-SQL-JDBC/GetDriverPropertyInfo.htm

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文