I have created a project in Spring boot and JPA which is deployed on a VM and my database is on another VM. At time of deployment it is taking to much time to connect to the database and also for every request(read/write operation) also it is taking more time then normal (when mysql was on the same VM).
My application.properties file is:
spring.datasource.url=jdbc:mysql://<remoteip>:3306/dbname?useSSL=false
spring.datasource.username=root
spring.datasource.password =root
// Keep the connection alive if idle for a long time (needed in production)
spring.datasource.testWhileIdle=true
spring.datasource.validationQuery=SELECT 1
And gradle file
compile('mysql:mysql-connector-java')
compile("org.springframework.boot:spring-boot-starter-data-rest")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile('org.springframework.boot:spring-boot-starter-web')
compile("org.springframework.boot:spring-boot-starter-undertow:1.5.1.RELEASE")
Is this happening because JPA creating connection pool? i am using undertow server.