我正在尝试使用 Commons DBCP 配置 Oracle 数据源,但它抛出主题错误
我正在开发 CentOS
private String driverClassName="oracle.jdbc.driver.OracleDriver" ;
private String url="jdbc:oracle:thin:@164.173.28.18:1521:XE";
private String userName="username";
private String password="password";
private static int MAX_ACTIVE= 10;
private BasicDataSource ds = null;
public void init() throws SQLException{
ds = new BasicDataSource();
ds.setDriverClassName(driverClassName);
ds.setPassword(password);
ds.setUsername(userName);
ds.setUrl(url);
ds.setMaxActive(MAX_ACTIVE);
//check connections
ds.getConnection();
}
public Connection getOracleConnection() throws SQLException{
return ds.getConnection();
}
我该如何解决
DB.java:27: error: cannot find symbol
ds.setMaxActive(MAX_ACTIVE); ^
symbol: method setMaxActive(int)
location: variable ds of type BasicDataSource
1 error