-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove HikariCP and added new Initializable OracleDataSource
- Loading branch information
Showing
5 changed files
with
42 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/org/utplsql/cli/datasource/InitializableOracleDataSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.utplsql.cli.datasource; | ||
|
||
import oracle.jdbc.pool.OracleDataSource; | ||
|
||
import java.sql.CallableStatement; | ||
import java.sql.Connection; | ||
import java.sql.SQLException; | ||
|
||
public class InitializableOracleDataSource extends OracleDataSource { | ||
|
||
private String initSql; | ||
|
||
public InitializableOracleDataSource() throws SQLException { | ||
} | ||
|
||
@Override | ||
public Connection getConnection() throws SQLException { | ||
Connection con = super.getConnection(); | ||
|
||
if ( initSql != null && !initSql.isEmpty() ) { | ||
try (CallableStatement stmt = con.prepareCall(initSql)) { | ||
stmt.execute(); | ||
} | ||
} | ||
|
||
return con; | ||
} | ||
|
||
public void setConnectionInitSql( String sql ) { | ||
this.initSql = sql; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters