i have a web service that uses javax.sql.DataSource
as follows:
public class AccessMysql {
private static DataSource dataSource=null;
public AccessMysql(){
if (dataSource == null){
dataSource = DataSourceBuilder
.create()
.username("[username]")
.password("[password]")
.url("jdbc:mysql://[server]/testdb")
.driverClassName("com.mysql.jdbc.Driver")
.build();
}
}
...
}
The first time this class runs the following mysql command:
show processlist
shows 11 connections.
The service can access the database numerous times and my number of connections (as shown in via 'show processlist') consistently stays at 11.
Do these 11 connections ever go away on their own? Is there any way I can close them from Java?