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

Previous Next

The generic syntax of the connection string is:

jdbc:jrec:application@host:port

 

Here is an example code fragment that shows how to connect to a Rules Engine for the TRAVEL application:

String myconnection = "jdbc:jrec:TRAVEL@localhost:7777";

String user = "SomeUser";

String password = "SomePassword";

Connection c = null;

try

{

    c = DriverManager.getConnection(myconnection, user, password);

    c.setAutoCommit(false);

}

    catch (SQLException e)

{

    System.err.println("Can't establish connection" + e);

}