Creating JDBC Process Servers Manually

If you need to connect to a database not currently supported by the JDBC Process Server wizard, you set up your Process Server manually.

Parameters

The following JDBC-specific Process Server parameters are available:

  • JDBCOracleDBMSOutput - Use Oracle DBMS Output?.
    • JDBCOracleDBMSOutputDestination - either stderr.log or stdout.log. Defaults to stderr.log for CSV, and stdout.log for all others.
    • JDBCOracleDBMSOutputHeader - header to print before the dbms output. Defaults to <h3>Output</h3><hr><pre> for HTML, <output> for XML and nothing for all others.
    • JDBCOracleDBMSOutputFooter - footer to print after the dbms output. Defaults to </pre></hr> for HTML, </output> for XML and nothing for all others.
  • JDBCServer - The alternative Process Server that is used to enable Queue jumping.
  • JDBCStatementFeedbackFormat Format of the SQL statement feedback in JDBC jobs. Possible options are: Simple, Normal or Extended.
  • JDBCStatementTimingFormat Should the duration of SQL statements in JDBC jobs be printed and if so, in milliseconds or in pretty format. Possible options are: None, MilliSeconds, Pretty (Default).
  • DefaultRunAsUser - Though not specifically JDBC-related, this Process Server parameter allows you to specify the default Run As User for all Process Definitions running on the Process Server.
  • v7PLSQLApiAvailable - This Process Server parameter is automatically set by the Process Server when the version 7 PL/SQL API is detected.

JDBC Drivers

Redwood Platform ships with drivers for DB2 9.1 to 11.5, Oracle 11g to 19c, SQL Server 2000 to 2019, and PostgreSQL version 9 to 12.3. If you need different JDBC drivers, you upload the driver to a Custom_Driver library that you reference on the Process Server.

When you upload a driver to a library, you specify the library and driver class name on the database object.

Prerequisites

  • username/password and connection string for the database you want to access.
  • a free slot in your ProcessServerService.JDBC.limit license key.

Procedure

Create the Credential

  1. Navigate to "Security > Credentials".
  2. Choose New Credential from the context menu.
  3. Ensure the Partition field contains the same value as the Process Server.
  4. Select JDBC in the Protocol field.
  5. Fill the username and password into the Real User and Password fields, retype the password into the Retype field.
  6. In the Endpoint field, fill the name of the Process Server.
  7. Click Save & Close.

Upload a Driver to a Library

Note that this step is only required when there is no JDBC driver on the classpath of your application server.

  1. Retrieve the latest JDBC driver for your database from the database vendor's website.
  2. Rename the JAR file, the name must contain only US ASCII letters, underscores, numbers, and dots(.).
  3. Navigate to "Scripting > Libraries".
  4. Select Import JAR from the context menu.
  5. Select or create a library for the JAR file; note that the library name must start with the Custom_ prefix and only one version of a JDBC driver for a specific database vendor should be uploaded per library.
  6. Choose Browse and locate the JAR file to upload.
  7. Choose Send.

Create a Database

  1. Navigate to Environment > Databases.
  2. Choose New Database from the context menu.
  3. Fill in a Name.
  4. Select Oracle Thin in the Jdbc Driver Class Name field.
  5. Select Jdbc Url > Advanced and fill jdbc:oracle:thin:@ora12.example.com:1521/orcl into the field.
  6. Select example in the Connection User field.
  7. Click Save & Close.

Create the JDBC Process Server

  1. Navigate to "Environment > Process Servers".
  2. Choose New Process Server from the context menu, select Manual Setup.
  3. Fill a name into the Name field, select a Partition (optional).
  4. Choose Add service and select JDBCService.
  5. On the Parameters.
  6. Click Save & Close.

Add an Object Reference to Database Object

JDBC Process Servers need an object reference named Jdbc_ProcessServer_Database_Ref pointing at the database containing the database connection settings.

Issue the following code in the Shell:

Copy
{
  Partition p = jcsSession.getPartitionByName(<partition>);
  Database db = jcsSession.getDatabaseByName(p, <database_object_name>);
  ProcessServer ps = jcsSession.getProcessServerByName(p, <process_server_name>);
  ObjectReference objRef = ps.createObjectReference(db);
  objRef.setName("Jdbc_ProcessServer_Database_Ref");
  jcsSession.persist();
}

Example

Connecting to Oracle 12c with JDBC Driver

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 "Security > Credentials".
  2. Choose New Credential from the context menu.
  3. Select Example in the Partition field and JDBC in the Protocol field.
  4. Fill example and someSillyPassword into the Real User and Password fields, respectively, retype someSillyPassword into the Retype field.
  5. In the Endpoint field, fill JDBC_Oracle12c_DB.
  6. Click Save & Close.
  7. Navigate to Environment > Databases.
  8. Choose New Database from the context menu.
  9. Select Example in the Partition field and fill JDBC_Oracle12c_DB into the Name field.
  10. Select Oracle Thin in the Jdbc Driver Class Name field.
  11. Select Jdbc Url > Advanced and fill jdbc:oracle:thin:@ora12.example.com:1521/orcl into the field.
  12. Select example@JDBC_Oracle12c_DB in the Connection User field.
  13. Click Save & Close.
  14. Navigate to "Environment > Process Servers".
  15. Choose New Process Server from the context menu; select Manual Setup and choose Next.
  16. Select Example in the Partition field and fill JDBC_Oracle12c_ProcessServer into the Name field.
  17. Choose Add service and select JDBCService.
  18. Click Save & Close.
  19. Navigate to "Scripting > Shell" and fill the following code into the Shell field and choose Submit command.

Code to issue in the Shell:

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();
}

Connecting to Oracle 12c with JDBC Driver in Library

You want to connect to an Oracle database with the ojdbc7.jar driver.

The driver ships with the following info:

Copy
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
  1. Navigate to "Security > Credentials".
  2. Choose New Credential from the context menu.
  3. Select Example in the Partition field and JDBC in the Protocol field.
  4. Fill example and someSillyPassword into the Real User and Password fields, respectively, retype someSillyPassword into the Retype field.
  5. In the Endpoint field, fill JDBC_Oracle12cLib_DB.
  6. Click Save & Close.
  7. Navigate to "Scripting > Libraries".
  8. Choose Edit from the context menu of the Custom_Driver library; if the library does not exist, create it.
  9. On the JAR Files tab, choose Add, fill in a name into the Name field and choose upload to locate the JAR file on your system.
  10. Choose Save and Close.
  11. Navigate to Environment > Databases.
  12. Choose New Database from the context menu.
  13. Select Example in the Partition field and fill JDBC_Oracle12cLib_DB into the Name field.
  14. Select Custom_Driver in the Library field.
  15. Fill oracle.jdbc.OracleDriver into the Jdbc Driver Class Name field.
  16. Select Jdbc Url > Advanced and fill jdbc:oracle:thin:@ora12.example.com:1521/orcl into the field.
  17. Select example@JDBC_Oracle12cLib_DB in the Connection User field.
  18. Click Save & Close.
  19. Navigate to "Environment > Process Servers".
  20. Choose New Process Server from the context menu; select Manual Setup and choose Next.
  21. Select Example in the Partition field and fill JDBC_Oracle12cLib_ProcessServer into the name field.
  22. Choose Add service and select JDBCService.
  23. Click Save & Close.
  24. Navigate to "Scripting > Shell" and fill the following code into the Shell field and choose Submit command.

Code to issue in the Shell:

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();
}

See Also