wd-jdbc-driver allows Java programs to connect to a Watson Discovery projects, collections, and documents via JDBC driver interfaces in pure Java code. This will enable Watson Discovery to integrate with Cloud Pak for Data as data asset.
With this jdbc driver, you can list documents and the results of enrichments in Watson Discovery in a single table view as data asset.
One of the application is to create a dashboard to list different information extracted from the same location in document.
- Build with Java 17 JDK for Gradle
./gradlew generateGrammarSource
./gradlew spotlessApply
./gradlew shadowJar
Fat JAR file should be created in ./build/libs
.
This jar is compatible with Java 8 JDK. (This is required by IBM Cloud Pak for Data : https://www.ibm.com/docs/en/cloud-paks/cp-data/4.8.x?topic=catalogs-generic-jdbc-connection)
./gradlew test
Before go through these steps, make sure your collection has a field that can be used for wdCursorKeyFieldPath
.
- Login to CP4D console.
- Go to Side panel -> Data -> Platform Connections.
- Select JDBC drivers tab
- Drag and drop the JAR file built in
build/libs/
directory. - Select New generic JDBC connection button.
- Select Generic JDBC connection type in Add connection page.
- Fill in connection details
- Name: Any names e.g.,
wd-driver
- JAR uris: Select the JAR file you uploaded in the step above.
- JDBC url:
jdbc:wd://<WD_SERVICE_URL>
- JDBC driver:
com.ibm.wd.connector.jdbc.WDDriver
- Username:
bearer
for the instances in private CP4D cluster,iamapikey
for the instances in IBM Public Cloud. - Password: Bearer token for CP4D instance, IAM API key for IBM Cloud instances.
- Properties: You can put jdbc driver properties here. Followings would be the ones that you may set
wdCursorKeyFieldPath
: field path available in your collection that can be used as a cursor to scroll all of your documents. It should be unique and sortable.
- Name: Any names e.g.,
- Try Test connection and check the test passes
- Select Create.
- Create new Analytics project or select existing one.
- In project page, select Add to project -> Connection .
- Select From platform tab in Add connection page.
- Select the name of your connection created in the previous step.
- Add to project -> Data Refinery Flow
- In Data Refinery flow page, select Connection -> {name_of_connection} -> mySchema -> sample.
- You can preview the mocked data generated by this JDBC driver by clicking Preview button that has the mark of an eye.
- Click Add button.
- Save the Data Refinery flow.
We have some scripts to make it easier to insert cursor to docments in your collection.