开发者

How to set "SQL_NO_CACHE" default in a pooled mysql JDBC connection

开发者 https://www.devze.com 2023-03-22 07:45 出处:网络
Our mysql server has \"SQL_NO_CACHE\" off by default, and I wish it off for my application. I can rewrite all my SQL statements but it sound stupid.

Our mysql server has "SQL_NO_CACHE" off by default, and I wish it off for my application. I can rewrite all my SQL statements but it sound stupid.

According to the mysql docs the per connection default can be configure by the following command.

SET SESSION query_cache_t开发者_运维问答ype = OFF;

I wish this statement will be issues for each new connect created from by DataSource. However, I don't find it is a configurable properties in the connector/j JDBC driver.

DBCP's connectionInitSqls seem to be one of the option, but I am using 1.2.2 for some reason. And I may want to remove the dependency of DBCP (less is more).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号