dbcp连接池
public static Connection getConnection() throws ClassNotFoundException, SQLException{
BasicDataSource bSource = new BasicDataSource();
String drivername = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/java24?characterEncoding=UTF-8&useUnicode=true";
String username = "root";
String password = "root";
bSource.setDriverClassName(drivername);
bSource.setUrl(url);
bSource.setUsername(username);
bSource.setPassword(password);
return bSource.getConnection();
}