Making Java Client Programs Connect to a Rules Engine

Previous Next

To be able to connect to a Rules Engine, the computer on which the Java client programs run needs a set of JDBC driver Java classes. This is the only additional software requirement on the client computer; no other USoft software is required on the client computer. The USoft JDBC driver classes are delivered within the

USoft-installation-dir/java/JDBCClasses.jar

 

Java archive file.

As an alternative, the USoft driver classes are also available in a JDBCClasses.zip archive file. This serves Java virtual machines that do not support the Java archive format.

To make these classes available within Java, the Java virtual machine needs a reference to this jar file in its classpath. For example, to start a Java client program with the USoft classes in its classpath, you have to type in a command prompt window:

java –classpath C:\usoft-installation-dir\java\JDBCClasses.jar YourJdbcClient

 

To use the USoft Rules Engine in a Java program, four steps are needed within the Java program:

1.Load the USoft JDBC classes.
2.Open a connection to a Rules Engine.
3.Issue SQL statements via the JDBC API.
4.Close the connection.

The Java code fragments in the following sections can be compiled by a Java compiler and show the contents of a PERSON table that has been defined in a USoft repository.

To use JDBC classes in a Java program, include this import statement in the Java source file:

import java.sql.*;

 

 

See Also

Java Example Step 1: Loading the USoft JDBC Classes

Java Example Step 2: Opening a Connection to the Rules Engine

Java Example Step 3: Selecting Records

Java Example Step 4: Closing the Connection