コード例 #1
0
 public Connection newConnection() {
   try {
     Class.forName(config.getJdbcDriverClass());
     Connection conn =
         java.sql.DriverManager.getConnection(
             config.getDbUrl(), config.getDbUser(), config.getDbPassword());
     return conn;
   } catch (Throwable e) {
     throw new LogEvaluatorException("creating Connection in ConnectionFactory", e);
   }
 }
コード例 #2
0
 public boolean testConnection() {
   try {
     Class.forName(config.getJdbcDriverClass());
     Connection conn =
         java.sql.DriverManager.getConnection(
             config.getDbUrl(), config.getDbUser(), config.getDbPassword());
     conn.close();
     return true;
   } catch (Throwable e) {
     if (logger != null) {
       logger.println("connection not created");
       logger.println(e.toString());
     }
     return false;
   }
 }