使用dbcp : BasicDataSource

需要

commons-dbcp2

com.oracle.ojdbc6

        <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.1</version>
</dependency>
<!-- oracle jdbc 驱动 -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3.0</version>
</dependency>
public static DataSource setupDataSource() {
BasicDataSource ds = new BasicDataSource();
ds.setDriverClassName("oracle.jdbc.OracleDriver");
ds.setUrl("jdbc:oracle:thin:@//172.16.50.67:1521/orcl");
ds.setUsername("e_channel");
ds.setPassword("e_channel_test");
return ds;
}

配置地址

http://commons.apache.org/proper/commons-dbcp/configuration.html

示例地址
http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/doc/

上一篇:Wordpress引入多说插件


下一篇:Excel表格生成sql语句