In the below example, does JdbcTemplate create two connections or one?
public class MyDao {
private JdbcTemplate jdbcTemplate;
public List<Data1> getData1() {
return jdbcTemplate.query(mySql, myParams, myCallback);
}
public List<Data2> getData2() {
jdbcTemplate.query(mySql2, myParams2, myCallback2);
}
}
public class Main {
public static void main(String[] args) {
MyDao dao = new MyDao();
List<Data1> d1 = dao.getData1();
List<Data2> d2 = dao.getData2();
doStuff(d1, d2);
}
}
That is to say, does it reuse the connection from the first query? We are assuming that it was constructed with a basic data source (not a pooled data source).