All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bixuebihui.datasource.DruidDataSourceAdapter Maven / Gradle / Ivy

Go to download

a fast small database connection pool and a active record flavor mini framework

There is a newer version: 1.15.8.3
Show newest version
package com.bixuebihui.datasource;

import com.alibaba.druid.pool.DruidDataSource;
import com.bixuebihui.dbcon.DatabaseConfig;


/**
 * 

DruidDataSourceAdapter class.

* * @author xingwx * @version $Id: $Id */ public class DruidDataSourceAdapter extends DruidDataSource implements INamingPool { /** * */ private static final long serialVersionUID = -3090433579721571673L; /** *

getAlias.

* * @return a {@link java.lang.String} object. */ @Override public String getAlias() { return getName(); } /** {@inheritDoc} */ @Override public void setAlias(String alias) { this.setName(alias); } /** {@inheritDoc} */ @Override public void setDatabaseConfig(DatabaseConfig cfg) { this.setAlias(cfg.getAlias()); this.setDriverClassName(cfg.getClassName()); this.setUrl(cfg.getDburl()); this.setUsername(cfg.getUsername()); this.setPassword(cfg.getPassword()); this.setMaxActive(cfg.getMaxActive()); this.setMaxWait(cfg.getMaxWaitTime()); this.setMaxOpenPreparedStatements(cfg.getMaxOpenPreparedStatements()); this.setRemoveAbandoned(removeAbandoned); this.setRemoveAbandonedTimeout(cfg.getMaxIdle()); //防止过期 this.setValidationQuery("SELECT 'x'"); this.setTestWhileIdle(true); this.setTestOnBorrow(true); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy