Connecting to Oracle 12c with a JDBC Driver

On-Premises

Redwood Platform ships with Oracle JDBC drivers. If you want to use a newer driver version, then you will need to upload Oracle JDBC drivers to a library and reference it in your Database object. See the Connecting to Oracle 12c with JDBC Driver in Library example below.

  1. Navigate to Configure > Admin > Security > Credentials.
  2. Click New.
  3. Select a Partition.
  4. Choose JDBC from the CredentialProtocol dropdown list.
  5. Enter a username and password in the Real User and Password fields.
  6. In the Endpoint field, enter JDBC_Oracle12c_DB.
  7. Click Save & Close.
  8. Navigate to Configure > Admin > Manage Connectors > Databases.
  9. Click New.
  10. Select a Partition.
  11. Enter JDBC_Oracle12c_DB in the Name field.
  12. Select Oracle Thin from the Jdbc Driver Class Name dropdown list.
  13. Select Jdbc Url > Advanced and enter jdbc:oracle:thin:@ora12.example.com:1521/orcl into the field.
  14. Select an option from the Connection User dropdown list.
  15. Click Save & Close.
  16. Navigate to Configure > Control > Job Servers.
  17. Click New.
  18. Select a Partition.
  19. Enter JDBC_Oracle12c_ProcessServer in the Name field.
  20. On the Services tab, click and select JDBCService.
  21. On the Definition Types tab, click and select JDBC.
  22. Click Save & Close.
  23. Navigate to Configure > Automate > Scripting tools > Shell.
  24. Paste the following code into the Shell script field and then click Run command.
Copy
{
  Partition p = jcsSession.getPartitionByName("Example");
  Database db = jcsSession.getDatabaseByName(p, "JDBC_Oracle12c_DB");
  ProcessServer ps = jcsSession.getProcessServerByName(p, "JDBC_Oracle12c_ProcessServer");
  ObjectReference objRef = ps.createObjectReference(db);
  objRef.setName(Database.OBJECT_REFERENCE_NAME_JDBC_PROCESSSERVER);
  jcsSession.persist();
}

Using a Library

Assume you want to connect to an Oracle database with the ojdbc7.jar driver. The driver ships with the following info:

  • Name: Oracle Thin Client

  • Database URL: jdbc:oracle:thin:@<host>:<port>:<SID>

  • Alternate database URL: jdbc:oracle:thin:@<host>:<port>/<service_name>

  • Driver Name: oracle.jdbc.OracleDriver

To accomplish this:

  1. Navigate to Configure > Admin > Security > Credentials.
  2. Click New.
  3. Select a Partition.
  4. Choose JDBC from the CredentialProtocol dropdown list.
  5. Enter a username and password in the Real User and Password fields.
  6. In the Endpoint field, enter JDBC_Oracle12cLib_DB.
  7. Click Save & Close.
  8. Navigate to Configure > Automate > Scripting tools > Libraries.
  9. Choose Edit from the context menu of the Custom_Driver library. If the library does not exist, create it.
  10. On the JAR Files tab, click Add.
  11. Enter a name in the Name field and upload the JAR file from your system.
  12. Choose Save & Close.
  13. Navigate to Configure > Admin > Manage Connectors > Databases.
  14. Click New.
  15. Select a Partition.
  16. Enter JDBC_Oracle12cLib_DB in the Name field.
  17. Select Custom_Driver from the Library dropdown list.
  18. Enter oracle.jdbc.OracleDriver in the Jdbc Driver Class Name field.
  19. Select Jdbc Url > Advanced and fill jdbc:oracle:thin:@ora12.example.com:1521/orcl into the field.
  20. Select an option from the Connection User dropdown list.
  21. Click Save & Close.
  22. Navigate to Configure > Control > Job Servers.
  23. Click New.
  24. Select Manual Setup and choose Next.
  25. Select a Partition.
  26. Enter JDBC_Oracle12cLib_ProcessServer in the Name field.
  27. On the Services tab, click and select JDBCService.
  28. On the Definition Types tab, click and select JDBC.
  29. Click Save & Close.
  30. Navigate to Configure > Automate > Scripting tools > Shell.
  31. Paste the following code into the Shell script field and click Run command.
Copy
{
  Partition p = jcsSession.getPartitionByName("Example");
  Database db = jcsSession.getDatabaseByName(p, "JDBC_Oracle12c_DB");
  ProcessServer ps = jcsSession.getProcessServerByName(p, "JDBC_Oracle12c_ProcessServer");
  ObjectReference objRef = ps.createObjectReference(db);
  objRef.setName(Database.OBJECT_REFERENCE_NAME_JDBC_PROCESSSERVER);
  jcsSession.persist();
}