PingDirectory

Create the JDBC extension

The Java database connectivity (JDBC) extension implementation must be written in Java, or the Groovy scripting language. Consult the Server SDK documentation for details on how to build and deploy extensions. The examples in this guide use Java. Java extensions are more strict and will catch programming errors during compile time rather than at runtime. Groovy is more flexible and can accomplish more with less lines of code.

Groovy scripts must reside in the /lib/groovy-scripted-extensions directory (Java implementations reside in /lib/extensions), which may also contain other plugins built using the Server SDK. If a script declares a package name, it must live under the corresponding folder hierarchy, just like a Java class. For example, to use a script class called ComplexJDBCSyncSource whose package is com.unboundid.examples.oracle, place it in /lib/groovy-scripted-extensions/com/unboundid/examples/oracleand set the script- class property on the Sync Source to com.unboundid.examples.oracle.ComplexJDBCSyncSource. There are a few reference implementations provided in the config/jdbc/samples directory. Use the manage-extension tool in the bin directory, or bat (Windows) to install or update the extension. See the Server SDK extensions section for more information.

When using custom JDBC endpoints, SQL statements cannot be called unless JDBC drivers are set in the java.properties file. For example:

start-server.java-args=<…​> -Djdbc.drivers=com.microsoft.sqlserver.jdbc.SQLServerDriver

The admin must run dsjavaproperties for the update to the java.properties file to take effect.

Any changes to an existing script require a manual Sync Pipe restart. Any configuration change automatically restarts the affected Sync Pipe.

The default libraries available on the classpath to the script implementation include:

  • Groovy

  • Lightweight Directory Access Protocol (LDAP) SDK for Java

  • JRE

Logging from within a script can be done with the Server SDK’s ServerContext abstract class. Some of the ServerContext methods are not available when the resync tool runs, because it runs outside of the PingDataSync process. Any logging during a resync operation is saved to the logs/tools/resync.log file.