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.
2) Call dfx in Java program.
publicvoid testDataServer(){
Connection con = null;
com.esproc.jdbc.InternalCStatementst;
com.esproc.jdbc.InternalCStatement st2;
try{
//create a connection
Class.forName("com.esproc.jdbc.InternalDriver");
con= DriverManager.getConnection("jdbc:esproc:local://");
//call the stored procedure in which test is the name of dfx file
st =(com.esproc.jdbc.InternalCStatement)con.prepareCall("calltest(?)");
//set the parameters
st.setObject(1,"3");
//the result obtained by executing the following code is the same as that obtained using the above calling method
st =(com.esproc.jdbc.InternalCStatement)con.prepareCall("call test(3)");
//execute the stored procedure
st.execute();
//get result set
ResultSet set = st.getResultSet();
}
catch(Exception e){
System.out.println(e);
}
finally{
//close the connection
if (con!=null) {
try {
con.close();
}
catch(Exception e) {
System.out.println(e);
}
}
}
}
To know more about calling methods and configuration, please refer to documents that cover a more in-depth discussion at this point.