import java.sql.Connection;
import java.sql.SQLException;
import com.statestreet.ssgx.ssa.db.DBHelper;
public class DBConnectionTest {
public static void main(String[] args) throws SQLException {
Connection con1 = DBHelper.getConnection("jdbc:oracle:thin:@server:service", "admin", "pass");
Connection con2 = DBHelper.getConnection("jdbc:oracle:thin:@server:service", "admin", "pass");
con1.close();
System.out.println("con1 is closed? " + con1.isClosed());
System.out.println("con2 is closed? " + con2.isClosed());
con2.close();
System.out.println("con2 is closed? " + con2.isClosed());
}
}
运行结果:
con1 is closed? true
con2 is closed? false
con2 is closed? true