Running the StaticBinder utility for client optimization from an application

You can run the StaticBinder utility from an application by calling the utility's bind() method.

Use the bind() method of the com.ibm.pdq.tools.StaticBinder class to bind your application's SQL statements into DB2® packages at run time. The method returns a value of FALSE if the bind operation fails, and a value of TRUE if the bind operation runs successfully.

The method takes two parameters. The first is a String array for passing arguments to the StaticBinder utility. The second is a PrintWriter object that the StaticBinder utility can print messages and exceptions to.

Here is an example of a call to the bind() method:

StaticBinder binder = new StaticBinder ();
PrintWriter  out = new PrintWriter(
	  new FileWriter("BinderOutput.txt"));
String[] argsArray = {"-user","username","-password","password", 
	  "-url","JDBC-URL","-pureQueryXml","pureQueryXML-file|pureQueryXML-file:base-package-name"};
Boolean check=binder.bind(argsArray, out);

Feedback