InformixConnectionPool


package com.huawei.db;

import java.sql.*;

/**
* 分配,回收和管理JDBC连接
*/

public class InformixConnectionPool extends JdbcPool
{
     public InformixConnectionPool
     (
                        String driver, String url,
                        String username, String password,
                        int initialConnections,
                        int maxConnections,
                        int lockwait,
                        boolean waitIfBusy)
          throws SQLException
     {
         super(driver, url, username, password, initialConnections, maxConnections, waitIfBusy);
     }
    
     /*
      *明确地建立一连接。当ConnectionPool初始化时被在前台调用
      *而当ConnectionPool在运行时,该函数在后台线程中被调用
      */
     protected Connection makeNewConnection () throws SQLException
     {
          try
          {
               // Load database driver if not already loaded
               DriverManager.registerDriver((Driver)Class.forName(driver).newInstance());
             
               Connection connection =
               DriverManager.getConnection(url, username, password);
             
               return(connection);
          }
          catch(ClassNotFoundException cnfe)
          {
               // Simplify try/catch blocks of people using this by
               // throwing only one exception type.
               throw new SQLException("Can't find class for driver: " +
                        driver);
          }
          catch(Exception e)
          {
               throw new SQLException("some error getConnection="+e.toString());
          }
     }
}

你可能感兴趣的:(InformixConnectionPool)