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 the session object
MySession = new CTSession(SESSION_TYPE.CTREE);
// allocate the table objects
tableCustOrdr = new CTTable(MySession);
tableOrdrItem = new CTTable(MySession);
tableItemMast = new CTTable(MySession);
tableCustMast = new CTTable(MySession);
// allocate the record objects
recordCustOrdr = new CTRecord(tableCustOrdr);
recordOrdrItem = new CTRecord(tableOrdrItem);
recordItemMast = new CTRecord(tableItemMast);
recordCustMast = new CTRecord(tableCustMast);
} 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);
}
}