esProc can be embedded into Java program. So the latter can call the cellset program written in esProc using a way of connection such as JDBC. The method of calling the esProc program is the same as that of calling the stored procedure. The following is a brief introduction to esProc JDBC.
1. Description of the jars of esProc JDBC
esProc JDBC is like an incomplete database JDBC driver without physical tables. It can be regarded simply as a database that only supports the stored procedure. In addition, itisa built-in computing engine, thus no standalone servers are needed.
esProc JDBC has five basic jars, which are all situated in \esProc\ lib in installation directory:
dm.jar esProc computing engine and JDBC driver
poi-3.7-20101029.jar process the access of Excel files
log4j_128.jar process logs
icu4j_3_4_5.jar handle internationalization
dom4j-1.6.1.jar parse the configuration files
If other databases are to be used as the datasources of esProc JDBC, then the driver jars of these databases are required to be in place. For example, hsqldb.jar is necessary to use the demo database. Please note the esProc JDBC requires JDK1.6 or higher versions.
2. Basic usage of esProc JDBC
In the cellset code, the result set is returned by result statement.
In the application code, arg1 is a cellset parameter. This dfx file will be named as test.dfx.
Note: The result set ofdfxis returned by result statement. When dfx is called, the parameter names that receive the parameters wonât be used; the values of parameters will be assigned according to their order instead.
1) Load the jars to be used. Load the basic jars of esProc JDBC mentioned above while launching the Java application. These jars can be put in the directory of WEB-INF/libunder a web application.
2)Deploy dfxConfig.xml, config.xml and the dfx file
Prepare file config.xml, which contains the basic configuration information of esProc, such as registration code, searching path, datasource configuration, etc. The file can be found in the path esProc\configin esProcâs installation directory. The information in it is the same as that set in the esProc Option page. The configuration is allowed to be adjusted before deployment (like modifying the Searching path which is used to search the dfx file):
Or the datasources necessary for dfxcan be configured in the Data Source Explorer:
After the modification, config.xml and dfxConfig.xml, which are situated in esProc\classes in the esProcâs installation directory, will be saved in the class path of the application that will use them.
Put the test.dfx created in Step 1 in the class path of the application, or put it in the path specified by file dfxConfig.xmlâs<paths/> node (i.e. the above-mentioned Searching path).
1)Further configure file dfxConfig.xml manually if necessary. For detailed operation, please refer to related documents. Please note the name of configured file should still be dfxConfig.xml and must not be changed.