How to set custom connection properties on DataSource in Spring Boot 1.3.x with default Tomcat connection pool

后端 未结 4 1476
再見小時候
再見小時候 2020-12-31 11:01

I need to set some specific Oracle JDBC connection properties in order to speed up batch INSERTs (defaultBatchValue) and mass SELECTs

4条回答
  •  梦毁少年i
    2020-12-31 11:23

    Setting the pools connectionProperties should work. Those will be passed to the JDBC driver. Add this to application.properties:

    spring.datasource.connectionProperties: defaultRowPrefetch=1000;defaultBatchValue=1000
    

    Edit (some background information):

    Note also that you can configure any of the DataSource implementation specific properties via spring.datasource.*: refer to the documentation of the connection pool implementation you are using for more details.

    source: spring-boot documentation

提交回复
热议问题