public static void init(Properties conf){
  if (conf.containsKey("db.driver")) {
    DRIVER=conf.getProperty("db.driver");
  }
  if (conf.containsKey("db.url")) {
    URL=conf.getProperty("db.url");
  }
  if (conf.containsKey("db.number")) {
    MAX_ACTIVE_NUMBER=Integer.parseInt(conf.getProperty("db.number"));
  }
  if (conf.containsKey("db.validation.sql")) {
    VALIDATION_SQL=conf.getProperty("db.validation.sql");
  }
  ds=new BasicDataSource();
  ds.setDriverClassName(DRIVER);
  ds.setUrl(URL);
  if (USER != null)   ds.setUsername(USER);
  if (PASSWD != null)   ds.setPassword(PASSWD);
  ds.setMaxActive(MAX_ACTIVE_NUMBER);
  ds.setMaxIdle(MAX_ACTIVE_NUMBER);
  ds.setMaxWait(MAX_WAIT_TIME);
  ds.setDefaultAutoCommit(true);
  ds.setDefaultReadOnly(false);
  ds.setValidationQuery(null);
  ds.setPoolPreparedStatements(true);
}

public static void init ( Properties conf ) { if ( conf . containsKey ( "db.driver" ) ) { DRIVER = conf . getProperty ( "db.driver" ) ; } if ( conf . containsKey ( "db.url" ) ) { URL = conf . getProperty ( "db.url" ) ; } if ( conf . containsKey ( "db.number" ) ) { MAX_ACTIVE_NUMBER = Integer . parseInt ( conf . getProperty ( "db.number" ) ) ; } if ( conf . containsKey ( "db.validation.sql" ) ) { VALIDATION_SQL = conf . getProperty ( "db.validation.sql" ) ; } ds = new BasicDataSource ( ) ; ds . setDriverClassName ( DRIVER ) ; ds . setUrl ( URL ) ; if ( USER != null ) ds . setUsername ( USER ) ; if ( PASSWD != null ) ds . setPassword ( PASSWD ) ; ds . setMaxActive ( MAX_ACTIVE_NUMBER ) ; ds . setMaxIdle ( MAX_ACTIVE_NUMBER ) ; ds . setMaxWait ( MAX_WAIT_TIME ) ; ds . setDefaultAutoCommit ( true ) ; ds . setDefaultReadOnly ( false ) ; ds . setValidationQuery ( null ) ; ds . setPoolPreparedStatements ( true ) ; }
initialize the db object by the configuration .
