利用dbcp连接池时,用同步写获取连接的方法好不好,希望给点已经。
public static  synchronized Connection getConnection()
throws IntegrateSQLException {
if (dataSource == null) {
init();
}
Connection conn = null;
if (dataSource != null) {
try {
conn = dataSource.getConnection();
} catch (SQLException e) {
throw new IntegrateSQLException(e);
}
}
return conn;
}