import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
public class Hdf extends BasicDataSource {
public DataSource getDataSource() {
DataSource ds = null;
super.setDriverClassName("oracle.jdbc.driver.OracleDriver");
super.setUrl("jdbc:oracle:thin:@192.168.0.2:1521:xmsm");
super.setUsername("risenetsm");
super.setPassword("qazwsxedc");
try {
ds = super.createDataSource();
} catch (SQLException e) {
e.printStackTrace();
}
return ds;
}
}
java中手动创建DataSource。
最新推荐文章于 2024-08-19 11:44:41 发布