Product Documentation

c-treeDB API for Java

Previous Topic

Next Topic

Init

First we need to open a connection to a database by providing the FairCom Database Engine with a user name, password and the database name.

Below is the code for Initialize():

static void Initialize() throws IOException {

System.out.println("INIT");

try {

// allocate objects

MySession = new CTSession(SESSION_TYPE.CTREE);

MyTable = new CTTable(MySession);

MyRecord = new CTRecord(MyTable);

} catch (CTException E) {

Handle_Exception(E);

}

try {

// connect to server

System.out.println("\tLogon to server...");

MySession.Logon("FAIRCOMS", "", "");

} catch (CTException E) {

Handle_Exception(E);

}

}

TOCIndex