Adapter Online Help > TDV File Data Sources > Adding a Custom Java Procedure
 
Adding a Custom Java Procedure
TDV has a JDBC interface and provides a bridge interface so that you can connect to a data source that is not currently supported. You can create a driver adapter that connects to that interface.
TDV supports custom procedures written in Java created to interface with other data sources. TDV provides APIs to create custom procedures.
A CJP library is a JAR file containing the Java classes implementing a set of Custom Java Procedures (CJPs) and other resources used by the CJPs. A CJP data source is a TDV custom data source that is created in Studio by specifying the signature of the CJP, a CJP library, and, optionally, a classpath. The classpath is needed only if the CJPs need resources that were not included in the CJP library.
For more details on TDV APIs to create custom Java procedures, see “JAVA APIs for Custom Procedures” in the TDV Reference Guide.
One adapter is sufficient to connect to any number of the same type of data sources. After it has been uploaded, the JDBC adapter functions like any other JDBC adapter, such as those used by Oracle, SQL Server, or MySQL. Customizations can be made to further change the adapter behavior.
You add a custom Java procedure to TDV Server as you would add a new data source. You must supply the specific JDBC driver and direct the server to the custom procedure JAR location so that TDV can upload it. The TDV server assumes that the JDBC adapter is implemented correctly. The server does not make any accommodations for JDBC adapters that do not supply correct metadata about the data source and it does not retrieve result sets that are not consistent with the metadata.
Note: If you need to export or import previously created custom Java procedures, see About Export and Import of Custom Java Procedures.
To add a custom Java procedure
1. Make sure that you have the Java code for the procedure.
2. Compile the Java code and put the compiled code into a JAR file.
Your classpath should point at <TDV_install_dir>\apps\extension\lib\csext-xxx.jar, where 'xxx' is your most recent patch level.
For instance, if TDV server is installed under C:\Apps\cis6.1 and you are running 6.1.0.00.24, then you would use:
javac -classpath C:\Apps\cis6.1\apps\extension\lib\csext-1024.jar TestCJP.java
3. Add the class to a JAR file. For example:
jar -cvf TestCJP.jar TestCJP.class
4. Place the JAR file on the machine where TDV Server is running.
5. Right-click at a location in the Studio resource tree where you want this data source to reside, and select New Data Source.
6. In the New Physical Data Source dialog, select Custom Java Procedure as the Data Source Adapter and click Next.
7. Supply the information for a custom Java procedure data source:
Name—Name for the data source.
Custom procedure jar location—Use the Browse button to locate the path to the JAR file containing the procedures on the server, or type the full path to the JAR file.
For example: file:///C:\myExamples\myProcedures.jar.
The JAR can be uploaded only from a file location that is visible to the TDV Server.
Additional classpath—Optionally, specify any classpath that might be needed by the Java custom procedure class. To specify multiple classpaths, separate them with semicolons.
For example, if the Java custom procedure uses classes contained in Widget.jar, you can type the path to Widget.jar, as follows:
C:/composite/Widget.jar
8. Click one of these buttons:
Create & Introspect—To proceed immediately with introspection.
Create & Close—To create the data source; you can introspect at a later time.
9. Refer the User Guide, Chapter Retrieving Data Source Metadata for how to introspect now or later.