如何使用springboot和hibernate传递jdbc参数? [英] How do i pass a jdbc paramater using springboot and hibernate?

查看:157
本文介绍了如何使用springboot和hibernate传递jdbc参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用spring-boot编写的应用程序(我是新手,所以如果问题很愚蠢,请原谅我),该应用程序使用hibernate 4和postgresql作为数据库后端. 我注意到数据库上属于连接池的一堆连接说明:"SET extra_float_digits = 3"

I have an application written with spring-boot (i am new to it so please forgive me if question is dumb) that uses hibernate 4 and postgresql as DB backend. I noticed a bunch of connections on the DB that belong to the connection pool stating: "SET extra_float_digits = 3"

谷歌搜索,我发现这可能是由于使用了旧的协议,使用jdbc驱动程序的 assumeMinServerVersion 参数可以避免这种情况. 现在我的问题是:如何从spring-boot应用程序中传递/设置该参数?

Googling around, I've found that it is probably due to the use of the old protocol and that could be avoided using the assumeMinServerVersion parameter of the jdbc driver. Now my question is: how do i pass / set that parameter from a spring-boot application?

推荐答案

根据此页面您可以在jdbc网址中设置assumeMinServerVersion参数,例如

According to this page you could set a assumeMinServerVersion parameter in the jdbc url, something like

spring.datasource.url=jdbc:postgresql://localhost/test?assumeMinServerVersion=XYZ

这篇关于如何使用springboot和hibernate传递jdbc参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆