Skip to content

Commit a716c77

Browse files
author
Aryan-Verma
committed
Oracle refactoring work
1 parent a34798a commit a716c77

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

database-commons/src/main/java/io/cdap/plugin/db/source/AbstractDBSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public Schema getSchema(Class<? extends Driver> driverClass) throws IllegalAcces
146146
}
147147
}
148148

149-
private Schema loadSchemaFromDB(Connection connection, String query) throws SQLException {
149+
public Schema loadSchemaFromDB(Connection connection, String query) throws SQLException {
150150
Statement statement = connection.createStatement();
151151
statement.setMaxRows(1);
152152
if (query.contains("$CONDITIONS")) {

database-commons/src/main/java/io/cdap/plugin/util/DriverCleanup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* class to de-register driver
2929
*/
3030
public class DriverCleanup implements Destroyable {
31-
private final JDBCDriverShim driverShim;
31+
public final JDBCDriverShim driverShim;
3232

3333
DriverCleanup(@Nullable JDBCDriverShim driverShim) {
3434
this.driverShim = driverShim;

oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSource.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,21 @@ public static class OracleSourceConfig extends AbstractDBSpecificSourceConfig {
103103
@Description("The existing connection to use.")
104104
private OracleConnectorConfig connection;
105105

106+
@Name(OracleConstants.ROLE)
107+
@Description("Login role of the user when connecting to the database.")
108+
@Nullable
109+
private String role;
110+
111+
@Name(OracleConstants.NAME_DATABASE)
112+
@Description("SID or Service Name to connect to")
113+
@Nullable
114+
private String database;
115+
116+
@Name(OracleConstants.TRANSACTION_ISOLATION_LEVEL)
117+
@Description("The transaction isolation level for the database session.")
118+
@Nullable
119+
private String transactionIsolationLevel;
120+
106121
@Name(OracleConstants.DEFAULT_BATCH_VALUE)
107122
@Description("The default batch value that triggers an execution request.")
108123
@Nullable
@@ -113,6 +128,18 @@ public static class OracleSourceConfig extends AbstractDBSpecificSourceConfig {
113128
@Nullable
114129
private Integer defaultRowPrefetch;
115130

131+
public OracleSourceConfig(String host, int port, String user, String password, String jdbcPluginName,
132+
String connectionArguments, String connectionType, String role, String database,
133+
String transactionIsolationLevel, int defaultBatchValue, int defaultRowPrefetch) {
134+
this.connection = new OracleConnectorConfig(host, port, user, password, jdbcPluginName, connectionArguments,
135+
connectionType);
136+
this.role = role;
137+
this.database = database;
138+
this.transactionIsolationLevel = transactionIsolationLevel;
139+
this.defaultBatchValue = defaultBatchValue;
140+
this.defaultRowPrefetch = defaultRowPrefetch;
141+
}
142+
116143
@Override
117144
public String getConnectionString() {
118145
if (OracleConstants.TNS_CONNECTION_TYPE.equals(connection.getConnectionType())) {

0 commit comments

Comments
 (0)