Product Documentation

FairCom JDBC

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():

//

// Initialize()

//

// Perform the minimum requirement of logging onto the c-tree Server

//

private static void Initialize ()

{

System.out.println("INIT");

try

{

// load the driver

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

// connect to server

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

conn = DriverManager.getConnection ("jdbc:ctree://localhost:6597/ctreeSQL", "ADMIN", "ADMIN");

// disable commit after each single SQL statement

conn.setAutoCommit(false);

// create statement handles

stmt = conn.createStatement();

}

catch (SQLException e)

{

Handle_Exception(e);

}

catch (Exception e)

{

Handle_Exception(e);

}

}

TOCIndex