Run SQL statement at beginning of each DB connection in Spring Boot

大憨熊 提交于 2019-12-01 00:29:07
Ralph

Tomcat Jdbc Connection pool has a parameter "initSQL" https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html

It looks like you can configure each pool parameter in your .properties file (@see https://stackoverflow.com/a/25573035/280244)

So give a try,

Spring Boot before 1.4:

spring.datasource.initSQL=ALTER SESSION SET CURRENT_SCHEMA=xxxx

Spring Boot 1.4 or later:

spring.datasource.tomcat.initSQL=ALTER SESSION SET CURRENT_SCHEMA=xxxx
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!