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

后端 未结 4 1485
再見小時候
再見小時候 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条回答
  •  醉话见心
    2020-12-31 11:24

    As Spring Boot is EOL for a long time I switched to Spring Boot 2.1 with its new default connection pool Hikari. Here the solution is even more simply and can be done in the application.properties or (like shown here) application.yml:

    spring:
      datasource:
        hikari:
          data-source-properties:
            defaultRowPrefetch: 1000
    

    (In a real-life config there would be several other configuration items but as they are not of interest for the question asked I simply left them out in my example)

提交回复
热议问题