anderix.datajets
Interface ConnectionGenerator


public interface ConnectionGenerator

Used to manage java.sql.Connection objects required by DataJets. The DataJet class can create and manage its own Connection objects, or you can manage them yourself using a ConnectionGenerator. Creating a class that implements ConnectionGenerator allows you to do the following:


Method Summary
 void closeConnection(java.sql.Connection con)
          Frees resources after DataJet is finished using the Connection.
 java.sql.Connection createConnection()
          Establishes the connection to be used by a DataJet.
 

Method Detail

createConnection

java.sql.Connection createConnection()
                                     throws ConnectionException
Establishes the connection to be used by a DataJet. A typical implementation contains:
        String driver = [insert driver];
        String url = [insert connection url];
        Class.forName(driver);
        Connection con = DriverManager.getConnection(url);
        return con;
        

Throws:
ConnectionException - if there is a problem creating a connection to the database

closeConnection

void closeConnection(java.sql.Connection con)
Frees resources after DataJet is finished using the Connection. A typical implementation contains:
    try {
        con.close();
    } catch ( Exception ex ) {
        //no action required - connection is already closed.
    }