Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Replace Oracle Connection Pool with HikariCP
  • Loading branch information
pesse authored and Samuel Nitsche committed Nov 21, 2017
commit d0fa80ced9b0db520c099023b94c459465f5093a
26 changes: 22 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
<artifactId>java-api</artifactId>
<version>3.0.4</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ucp</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.beust</groupId>
Expand All @@ -30,10 +36,22 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.7.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.25</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>

Expand Down
16 changes: 6 additions & 10 deletions src/main/java/org/utplsql/cli/ConnectionInfo.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package org.utplsql.cli;

import com.beust.jcommander.IStringConverter;
import oracle.ucp.jdbc.PoolDataSource;
import oracle.ucp.jdbc.PoolDataSourceFactory;
import com.zaxxer.hikari.HikariDataSource;

import java.io.File;
import java.sql.Connection;
Expand All @@ -22,16 +21,13 @@ public class ConnectionInfo {
}
}

private PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource();
private HikariDataSource pds = new HikariDataSource();

public ConnectionInfo(String connectionInfo) {
try {
this.pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
this.pds.setURL("jdbc:oracle:thin:" + connectionInfo);
this.pds.setInitialPoolSize(2);
} catch (SQLException e) {
e.printStackTrace();
}

pds.setJdbcUrl("jdbc:oracle:thin:" + connectionInfo);
pds.setAutoCommit(false);

}

public Connection getConnection() throws SQLException {
Expand Down