Skip to content

Commit d0fa80c

Browse files
pesseSamuel Nitsche
authored andcommitted
Replace Oracle Connection Pool with HikariCP
1 parent 354f417 commit d0fa80c

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

pom.xml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
<artifactId>java-api</artifactId>
2323
<version>3.0.4</version>
2424
<scope>compile</scope>
25+
<exclusions>
26+
<exclusion>
27+
<groupId>com.oracle.jdbc</groupId>
28+
<artifactId>ucp</artifactId>
29+
</exclusion>
30+
</exclusions>
2531
</dependency>
2632
<dependency>
2733
<groupId>com.beust</groupId>
@@ -30,10 +36,22 @@
3036
<scope>compile</scope>
3137
</dependency>
3238
<dependency>
33-
<groupId>junit</groupId>
34-
<artifactId>junit</artifactId>
35-
<version>4.12</version>
36-
<scope>test</scope>
39+
<groupId>com.zaxxer</groupId>
40+
<artifactId>HikariCP</artifactId>
41+
<version>2.7.2</version>
42+
<scope>compile</scope>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.slf4j</groupId>
46+
<artifactId>slf4j-nop</artifactId>
47+
<version>1.7.25</version>
48+
<scope>compile</scope>
49+
</dependency>
50+
<dependency>
51+
<groupId>junit</groupId>
52+
<artifactId>junit</artifactId>
53+
<version>4.12</version>
54+
<scope>test</scope>
3755
</dependency>
3856
</dependencies>
3957

src/main/java/org/utplsql/cli/ConnectionInfo.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package org.utplsql.cli;
22

33
import com.beust.jcommander.IStringConverter;
4-
import oracle.ucp.jdbc.PoolDataSource;
5-
import oracle.ucp.jdbc.PoolDataSourceFactory;
4+
import com.zaxxer.hikari.HikariDataSource;
65

76
import java.io.File;
87
import java.sql.Connection;
@@ -22,16 +21,13 @@ public class ConnectionInfo {
2221
}
2322
}
2423

25-
private PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource();
24+
private HikariDataSource pds = new HikariDataSource();
2625

2726
public ConnectionInfo(String connectionInfo) {
28-
try {
29-
this.pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
30-
this.pds.setURL("jdbc:oracle:thin:" + connectionInfo);
31-
this.pds.setInitialPoolSize(2);
32-
} catch (SQLException e) {
33-
e.printStackTrace();
34-
}
27+
28+
pds.setJdbcUrl("jdbc:oracle:thin:" + connectionInfo);
29+
pds.setAutoCommit(false);
30+
3531
}
3632

3733
public Connection getConnection() throws SQLException {

0 commit comments

Comments
 (0)