Product Documentation

FairCom JDBC Developer's Guide

Previous Topic

Next Topic

An Example Connection

The following example shows a code excerpt that illustrates loading the driver and connecting to the default server and database. The following example uses the form of DriverManager.GetConnection() that takes authentication information as a single Properties object.

Example Loading the JDBC Driver and Connecting to a Database


String url = "jdbc:ctree://localhost:6597/ctreeSQL";

String userid = "ADMIN";

String passwd = "ADMIN";


// Load the driver

Class.forName ("ctree.jdbc.ctreeDriver");


// Attempt to connect to a driver. Each one

// of the registered drivers will be loaded until

// one is found that can process this URL.

java.util.Properties prop = new java.util.Properties();

prop.put("user", userid);

prop.put("password", passwd);


Connection con = DriverManager.getConnection (url, prop);

TOCIndex