public class MyDB {
public static final String module = MyDB.class.getName();
private String dbName = "";
private PoolMan plmn = null;
public MyDB(String dbName) {
try {
if (plmn == null) {
plmn = (PoolMan) Class.forName("com.codestudio.sql.PoolMan").
newInstance();
}
} catch (Exception ec) {
System.out.println(ec.toString()+module);
}
this.dbName = dbName;
}
private Connection getNewConnection() {
Connection conn = null;
try {
conn = plmn.connect("jdbc:poolman://" + dbName);
conn.setAutoCommit(true);
} catch (Exception ec) {
System.out.println(ec.toString()+"First:Connect sqlsever failed"+module);
try {
Thread.sleep(1000);
文章来源于领测软件测试网 https://www.ltesting.net/