FileDocCategorySizeDatePackage
DbAccessObjectImpl.javaAPI DocGlassfish v2 API32888Fri May 04 22:24:18 BST 2007com.sun.enterprise.admin.monitor.callflow

DbAccessObjectImpl

public class DbAccessObjectImpl extends Object implements DbAccessObject
author
Harpreet Singh

Fields Summary
private static final Logger
logger
private static DbAccessObject
_singleton
private static final String
CALLFLOW_POOL_JNDI_NAME
private TableAccessObject
reqStart
private TableAccessObject
reqEnd
private TableAccessObject
methStart
private TableAccessObject
methEnd
private TableAccessObject
startTime
private TableAccessObject
endTime
private Connection
connection
private PreparedStatement
pstmtRS
private PreparedStatement
pstmtRE
private PreparedStatement
pstmtMS
private PreparedStatement
pstmtME
private PreparedStatement
pstmtST
private PreparedStatement
pstmtET
private String
serverName
private boolean
traceOn
private int
SECURITY_ID_INDEX_CSI
The following variables are used to reference into the columns that are returned by the getCallStackInformation Query
private int
TRANSACTION_ID_INDEX_CSI
private int
THREAD_ID_INDEX_CSI
private int
MODULE_NAME_INDEX_CSI
private int
METHOD_NAME_INDEX_CSI
private int
APP_NAME_INDEX_CSI
private int
COMPONENT_NAME_INDEX_CSI
private int
CONTAINER_TYPE_INDEX_CSI
private int
EXCEPTION_NAME_INDEX_CSI
private int
REQUEST_TYPE_INDEX_CSI
private int
TIMESTAMP_INDEX_CSI
private int
TABLE_TYPE_INDEX_CSI
private int
TIMESTAMP_MILLIS_INDEX_CSI
Constructors Summary
private DbAccessObjectImpl()
Creates a new instance of DbAccessObjectImpl

           
      
        reqStart = RequestStartAccessObjectImpl.getInstance();
        reqEnd = RequestEndAccessObjectImpl.getInstance();
        methStart = MethodStartAccessObjectImpl.getInstance();
        methEnd = MethodEndAccessObjectImpl.getInstance();
        startTime = StartTimeAccessObjectImpl.getInstance();
        endTime = EndTimeAccessObjectImpl.getInstance();
        traceOn = TraceOnHelper.isTraceOn();        
    
Methods Summary
public booleanclearData()

        if(!setupConnection()) 
            return false;
        boolean result =  clearData (connection);
        closeConnection ();
        return result;
    
private booleanclearData(java.sql.Connection connection)

        // even if 1 table delete fails, go ahead and delete the rest
        
        boolean rs = reqStart.dropTable(connection);       
        boolean re = reqEnd.dropTable(connection);
        boolean ms = methStart.dropTable(connection);
        boolean me = methEnd.dropTable(connection);
        boolean st = startTime.dropTable(connection);
        boolean et = endTime.dropTable(connection);
        
        if(rs == false || re == false || ms == false || me == false ||
		st == false || et == false)
            return false;
        return true;
        
    
private voidcloseConnection()

        try{
            if(connection != null){
                connection.close();
            }
        } catch (Exception e){
            logger.log(Level.WARNING, "Cannot close connection to CallFlow DB", e); 
        } finally {
            connection = null;
        }
    
private voidclosePreparedStatements()

        try{
            if(pstmtRS != null)
                pstmtRS.close();
        } catch (SQLException s){
            // log it to fine.
            logger.log(Level.FINE, "Could not close RequestStart SQL Statement", s);            
        }finally{
            pstmtRS = null;
        }
        try{
            if(pstmtRE != null)
                pstmtRE.close();
        } catch (SQLException e){
            // log it to fine
            logger.log(Level.FINE, "Could not close RequestEnd SQL Statement", e);            
        }finally{
            pstmtRE = null;
        }
        try{
            if(pstmtMS != null)
                pstmtMS.close();
        } catch (SQLException se){
            // log it to fine
            logger.log(Level.FINE, "Could not close MethodStart SQL Statement", se);                        
        } finally{
            pstmtMS = null;
        }
        try{
            if(pstmtME != null)
                pstmtME.close();
        } catch(SQLException sqe){
            //log it to fine.
            logger.log(Level.FINE, "Could not close MethodEnd SQL Statement", sqe);                        
        }finally{
            pstmtME = null;
        }        
        try{
            if(pstmtST != null)
                pstmtST.close();
        } catch(SQLException sqe){
            //log it to fine.
            logger.log(Level.FINE, "Could not close StartTime SQL Statement", sqe);                        
        }finally{
            pstmtST = null;
        }        
        try{
            if(pstmtET != null)
                pstmtET.close();
        } catch(SQLException sqe){
            //log it to fine.
            logger.log(Level.FINE, "Could not close EndTime SQL Statement", sqe);                                    
        }finally{
            pstmtET = null;
        }        
        
    
private voidcreatePreparedStatements()

        if(connection == null)
            if(!setupConnection())
                return;

        pstmtRS = connection.prepareStatement (reqStart.getInsertSQL());
        pstmtRE = connection.prepareStatement(reqEnd.getInsertSQL());
        pstmtMS = connection.prepareStatement(methStart.getInsertSQL());
        pstmtME = connection.prepareStatement(methEnd.getInsertSQL());
        pstmtST = connection.prepareStatement(startTime.getInsertSQL());
        pstmtET = connection.prepareStatement(endTime.getInsertSQL());

    
public booleandeleteRequestIds(java.lang.String[] requestIds)

//</editor-fold>    
    
         
        if (requestIds.length <=0 )
            return true;
        
        boolean resultRS = false;
        boolean resultRE = false;
        boolean resultMS = false;
        boolean resultME = false;
        boolean resultCS = false;
        boolean resultCE = false;
        
        PreparedStatement rs = null;
        PreparedStatement re = null;
        PreparedStatement ms = null;
        PreparedStatement me = null;
        PreparedStatement st = null;
        PreparedStatement et = null;
        
        
        if (connection == null)
            if (!setupConnection())
                return false;
        try {
            rs = connection.prepareStatement(reqStart.getDeleteSQL());
            resultRS = (rs == null)? false : reqStart.delete(rs, requestIds);
            if (!resultRS)
                 logger.log (Level.FINE, "Error deleting requests from Request Start Table");
        } catch (SQLException se){
            logger.log (Level.FINE, "Error deleting requests from Request Start Table", se);        
        }finally {
            if (rs != null){
                try{
                    rs.close();
                } catch (SQLException se){
                    // ignore
                } finally {
                    rs = null;
                }
            }
        }
        try{
            re = connection.prepareStatement(reqEnd.getDeleteSQL());
            resultRE = (re == null)? false : reqEnd.delete(re, requestIds);
            if (!resultRE)
                logger.log (Level.FINE, "Error deleting requests from Request End Table");
        } catch (SQLException se){
            logger.log (Level.FINE, "Error deleting requests from Request End Table", se);        
        } finally {
            if (re != null){
                try{
                    re.close();
                } catch (SQLException se){
                    // ignore
                } finally {
                    re = null;
                }
            }
        }
        try{
            ms = connection.prepareStatement(methStart.getDeleteSQL());
            resultMS = (ms == null)? false : methStart.delete(ms, requestIds);
            if (!resultMS)
                logger.log (Level.FINE, "Error deleting requests from Method Start Table");
        } catch (SQLException se){
            logger.log (Level.FINE, "Error deleting requests from Method Start Table", se);        
        }finally {
            if (ms != null){
                try{
                    ms.close();
                } catch (SQLException se){
                    // ignore
                } finally {
                    ms = null;
                }
            }
        }
        
        try{                   
            me = connection.prepareStatement(methEnd.getDeleteSQL());
            resultME = (me == null)? false : methEnd.delete(me, requestIds);
            if (!resultME)
                logger.log (Level.FINE, "Error deleting requests from Method End Table");
        }  catch (SQLException se){
            logger.log (Level.FINE, "Error deleting requests from MethodEnd Table", se);        
        }finally {
            if (me != null){
                try{
                    me.close();
                } catch (SQLException se){
                    // ignore
                } finally {
                    me = null;
                }
            }
        }
        
        try{
            st = connection.prepareStatement(startTime.getDeleteSQL());
            resultCS = (st == null)? false : startTime.delete(st, requestIds);                
            if (!resultCS)
                logger.log (Level.FINE, "Error deleting requests from Container Start Table");
        } catch (SQLException se){
            logger.log (Level.FINE, "Error deleting requests from Container Start Table", se);        
        }finally {
            if (st != null){
                try{
                    st.close();
                } catch (SQLException se){
                    // ignore
                } finally {
                    st = null;
                }
            }
        }
        try{
            et =connection.prepareStatement(endTime.getDeleteSQL());
            resultCE = (et == null)? false : endTime.delete(et, requestIds);
            if (!resultCE)
                logger.log (Level.FINE, "Error deleting requests from Container End Table");
        } catch (SQLException se){
            logger.log (Level.FINE, "Error deleting requests from End time Table", se);        
        }finally {
            if (et != null){
                try{
                    et.close();
                } catch (SQLException se){
                    // ignore
                } finally {
                    et = null;
                }
            }
        }
        if (resultRS && resultRE && resultMS && resultME && resultCS && resultCE)
            return true;
        return false;
    
public booleandisable()

        closePreparedStatements();
        closeConnection();
        return true;
    
public booleanenable()

    
        setupConnection();
        boolean result = enable(connection);
        if(result == true){
            try{
                createPreparedStatements();
            } catch (SQLException sqe){
                // log it
                // if preparedStatements are not created. No point doing anything
                // else.
                logger.log(Level.SEVERE, "callflow.enable_failed", sqe);    
                RuntimeException re = 
                        new RuntimeException ("Cannot create SQL Statements" +
                        " to connect to Callflow DB. Is database up?");
                re.initCause(sqe);
                throw re;
            } finally {
                closeConnection();            
            }
        } else if (result == false) { // as of now, we always return a true
            // even if the table creation fails. This should never be exercised
            // Keeping this code here such that if we change the semantics
            // of enable(connection) that would not break the callflow code.
             logger.log(Level.SEVERE, "callflow.enable_failed");
             closeConnection ();
             throw new RuntimeException ("Error creating tables");
        }
        return result;
    
private booleanenable(java.sql.Connection connection)

        // even if 1 table create fails, go ahead and create the rest
        
        boolean rs = reqStart.createTable(connection); 
        if (!rs)
            return false;
        boolean re = reqEnd.createTable(connection);
        if (!re)
            return false;
        boolean ms = methStart.createTable(connection);
        if (!ms)
            return false;
        boolean me = methEnd.createTable(connection);
        if (!me)
            return false;
        boolean st = startTime.createTable(connection);
        if (!st)
            return false;
        boolean et = endTime.createTable(connection);
        if (!et)
            return false;
        return true;
    
private java.lang.StringgenerateQuerySQL(java.lang.String sql)

        // append RS, RE , MS, ME table Name with __server name        
       String newsql = new String(sql);
       // replace RS Table with RS__server
       String table = TableInfo.REQUEST_START_TABLE_NAME;
       String tableWithServerName = getTableWithServerName (table);
       newsql = newsql.replaceAll(table, tableWithServerName);
       // RE
       table = TableInfo.REQUEST_END_TABLE_NAME;
       tableWithServerName = getTableWithServerName (table);
       newsql = newsql.replaceAll(table, tableWithServerName);
       
       // MS
       table = TableInfo.METHOD_START_TABLE_NAME;
       tableWithServerName = getTableWithServerName (table);
       newsql = newsql.replaceAll(table, tableWithServerName);

       // RE
       table = TableInfo.METHOD_END_TABLE_NAME;
       tableWithServerName = getTableWithServerName (table);
       newsql = newsql.replaceAll(table, tableWithServerName);
       if (traceOn){
           logger.log(Level.INFO, "Callflow: Query = \n[ "+newsql+" ]");
       }
       
       return newsql;               
    
private java.lang.StringgenerateQuerySQLForStartTimeAndEndTime(java.lang.String sql)

        // append ST, ET table Name with __server name        
       String newsql = new String(sql);
       // replace ST Table with ST__server
       String table = TableInfo.START_TIME_TABLE_NAME;
       String tableWithServerName = getTableWithServerName (table);
       newsql = newsql.replaceAll(table, tableWithServerName);
       // ET
       table = TableInfo.END_TIME_TABLE_NAME;
       tableWithServerName = getTableWithServerName (table);
       newsql = newsql.replaceAll(table, tableWithServerName);
       return newsql;               
    
private TableAccessObject[]getAccessObjectsAsArray()

        TableAccessObject[] tao = new TableAccessObject[6];
        tao[0] = reqStart;
        tao[1] = reqEnd;
        tao[2] = methStart;
        tao[3] = methEnd;
        tao[4] = startTime;
        tao[5] = endTime;
        return tao;
    
private java.util.MapgetCallStackCommonInformation(java.sql.ResultSet rs, java.util.Map map)

        
        // get columns common across all tables
        String request_id = rs.getString(TableInfo.REQUEST_ID);
        map.put(CallFlowMonitor.REQUEST_ID_KEY, request_id);

        long time_stamp = rs.getLong(TIMESTAMP_INDEX_CSI);
        map.put(CallFlowMonitor.TIME_STAMP_KEY, String.valueOf(time_stamp));

        long time_stamp_millis = rs.getLong (TIMESTAMP_MILLIS_INDEX_CSI);
        map.put (CallFlowMonitor.TIME_STAMP_MILLIS_KEY, String.valueOf(time_stamp_millis));

        return map;
    
public java.util.ListgetCallStackInformation(java.lang.String requestId)

       if(connection == null)
            if(!setupConnection())
                return null;
        assert connection != null;
        List list  = null;
        PreparedStatement stmt = null;
        try{
            String sql = generateQuerySQL (TableInfo.GET_CALLSTACK_INFORMATION_SQL);
            stmt = connection.prepareStatement(sql);
            
            stmt.setString(1, requestId);
            stmt.setString(2, requestId);
            stmt.setString(3, requestId);
            stmt.setString(4, requestId);
            ResultSet rs = stmt.executeQuery();
            list = new ArrayList<Map<String, String>>();
            while(rs.next()){
                Map<String, String> map = new HashMap<String, String> ();

                String table_type = rs.getString(TABLE_TYPE_INDEX_CSI);
                table_type = table_type.trim();
                map.put(CallFlowMonitor.CALL_STACK_ROW_TYPE_KEY, table_type);
                if (CallFlowMonitor.CALL_STACK_REQUEST_START.equals(table_type)){
                    map = getCallStackRequestStartInformation(rs, map);
                } else if (CallFlowMonitor.CALL_STACK_REQUEST_END.equals(table_type)) {
                    map = getCallStackRequestEndInformation(rs, map);
                } else if (CallFlowMonitor.CALL_STACK_METHOD_END.equals(table_type)){
                    map =  getCallStackMethodEndInformation(rs, map);
                } else if (CallFlowMonitor.CALL_STACK_METHOD_START.equals(table_type)){
                    map = getCallStackMethodStartInformation(rs, map);
                }
                list.add(map);
            }          
            stmt.close();
        } catch (SQLException se){
            // log it
            logger.log(Level.FINE, "callflow.error_get_callstack_info", se);   
        }
        closeConnection();
        return list;        
    
private java.util.MapgetCallStackMethodEndInformation(java.sql.ResultSet rs, java.util.Map map)

        map = getCallStackCommonInformation(rs, map);
        String exception_name = rs.getString(EXCEPTION_NAME_INDEX_CSI);
        map.put(CallFlowMonitor.EXCEPTION_KEY, exception_name);
        String status =
                (exception_name == null)? String.valueOf(Boolean.TRUE) :
                    String.valueOf(Boolean.FALSE);        
        map.put(CallFlowMonitor.STATUS_KEY, status);
        return map;
   
   
private java.util.MapgetCallStackMethodStartInformation(java.sql.ResultSet rs, java.util.Map map)

        map = getCallStackCommonInformation(rs, map);
        String container_type = rs.getString(CONTAINER_TYPE_INDEX_CSI);
        map.put(CallFlowMonitor.CONTAINER_TYPE_KEY, container_type);
        
        String component_name = rs.getString(COMPONENT_NAME_INDEX_CSI);
        map.put(CallFlowMonitor.COMPONENT_NAME_KEY, component_name);
        
        String app_name = rs.getString(APP_NAME_INDEX_CSI);
        map.put (CallFlowMonitor.APPLICATION_NAME_KEY, app_name);
        
        String method_name = rs.getString(METHOD_NAME_INDEX_CSI);
        map.put (CallFlowMonitor.METHOD_NAME_KEY, method_name);

        String module_name = rs.getString(MODULE_NAME_INDEX_CSI);
        map.put(CallFlowMonitor.MODULE_NAME_KEY, module_name);
        
        String thread_id = rs.getString(THREAD_ID_INDEX_CSI);
        map = getCallStackCommonInformation(rs, map);
        String exception_name = rs.getString(EXCEPTION_NAME_INDEX_CSI);
        map.put(CallFlowMonitor.EXCEPTION_KEY, exception_name);
        String status =
                (exception_name == null)? String.valueOf(Boolean.TRUE) :
                    String.valueOf(Boolean.FALSE);        
        map.put(CallFlowMonitor.STATUS_KEY, status);
        return map;
   
   
private java.util.MapgetCallStackRequestEndInformation(java.sql.ResultSet rs, java.util.Map map)

        map = getCallStackCommonInformation(rs, map);
        return map;
    
private java.util.MapgetCallStackRequestStartInformation(java.sql.ResultSet rs, java.util.Map map)

        map = getCallStackCommonInformation(rs, map);
        String request_type = rs.getString(REQUEST_TYPE_INDEX_CSI);
        map.put (CallFlowMonitor.REQUEST_TYPE_KEY, request_type);        
        return map;
    
public static synchronized DbAccessObjectgetInstance()
Factory Methodd to return DbAccessObject

return
DbAccessObject

        return _singleton;
    
public java.util.MapgetNumOfRequestsProcessed()

        Map<String, Long> map = new HashMap <String, Long> ();
        TableAccessObject[] tao = this.getAccessObjectsAsArray();
        for (int i = 0; i < tao.length; i++){
            if(tao[i] == null)
                break;
            else {
                map.put(tao[i].getName (), tao[i].getTotalEntriesProcessed());
            }
        }   
        return map;
    
public java.lang.StringgetNumOfRequestsProcessedAsString()

        Map<String, Long> map = getNumOfRequestsProcessed ();
        Set<String> keys = map.keySet();
        StringBuffer sb = new StringBuffer ();
        for (String key: keys){
            sb.append(" " + key+" : "+ map.get(key));
        }
        return sb.toString();
    
public java.util.MapgetPieInformation(java.lang.String requestId)

        closeConnection();
        connection = null;
        if(connection == null)
            if(!setupConnection())
                return null;
        Map<String, String> mapST  = null;
        Map<String, String> mapET = null;
        Map<String, String> retMap = null;
        PreparedStatement st = null;
        PreparedStatement et = null;
        try{
            String startSql = 
                generateQuerySQLForStartTimeAndEndTime (TableInfo.GET_PIE_INFORMATION_START_TIME_SQL);
            st = connection.prepareStatement(startSql);
            st.setString (1, requestId);
            ResultSet rs = st.executeQuery();
            mapST = new HashMap<String, String>();
            while(rs.next()){                             
                String container_type = rs.getString(1);
                long time_taken = rs.getLong(2);
                mapST.put(container_type, String.valueOf(time_taken));                
            }
            st.close();
            String endSql = 
                generateQuerySQLForStartTimeAndEndTime (TableInfo.GET_PIE_INFORMATION_END_TIME_SQL);
            et = connection.prepareStatement(endSql);
            et.setString (1, requestId);
            rs = et.executeQuery();
            mapET = new HashMap<String, String>();
            while(rs.next()){                             
                String container_type = rs.getString(1);
                long time_taken = rs.getLong(2);
                mapET.put(container_type, String.valueOf(time_taken));                
            }
            et.close();
            retMap = new HashMap <String, String> ();
            
            for (String key : mapST.keySet()){
                String stime = mapST.get(key);
                if (stime == null)
                    continue;
                long startTime = Long.valueOf(stime);
                String etime = mapET.get(key);
                if (etime == null )
                    continue;
                long endTime = Long.valueOf(etime);
                long time_taken = endTime - startTime;
                retMap.put (key, String.valueOf (time_taken));
            }
            
        } catch (SQLException se){
            // log it
            logger.log(Level.FINE, "callflow.error_get_pie_info", se);             
        }
        closeConnection();
        return retMap;
    
public java.util.ListgetRequestInformation()

        if(connection == null)
            setupConnection();
        if (traceOn){
            logger.log(Level.INFO, "Callflow: getRequestInfo");
        }
        
        assert connection != null;
        List<Map<String, String>> list  = null;
        Statement stmt = null;
        try{
            stmt = connection.createStatement();
            String query = generateQuerySQL(TableInfo.GET_REQUEST_INFORMATION_SQL);
            stmt.executeQuery(query);
            ResultSet rs = stmt.getResultSet();
            list = new ArrayList<Map<String, String>>();
            while(rs.next()){
                Map<String, String> map = new HashMap<String, String> ();
                
                String request_id = rs.getString(TableInfo.REQUEST_ID);
                map.put (CallFlowMonitor.REQUEST_ID_KEY, request_id);
                // no need to return time stamp in nano.
                long time_stamp = rs.getLong(TableInfo.TIME_STAMP_MILLIS);
                map.put (CallFlowMonitor.TIME_STAMP_MILLIS_KEY, String.valueOf(time_stamp));

                String ip_address = rs.getString(TableInfo.IP_ADDRESS);
                map.put (CallFlowMonitor.CLIENT_HOST_KEY, ip_address);
                
                String request_type = rs.getString(TableInfo.REQUEST_TYPE);
                map.put (CallFlowMonitor.REQUEST_TYPE_KEY, request_type);

                String method_name = rs.getString(TableInfo.METHOD_NAME);
                map.put (CallFlowMonitor.METHOD_NAME_KEY, method_name);
                
                String app_name = rs.getString(TableInfo.APP_NAME);
                map.put (CallFlowMonitor.APPLICATION_NAME_KEY, app_name);
                
                String security_id = rs.getString (TableInfo.SECURITY_ID);                
                map.put (CallFlowMonitor.USER_KEY, security_id);
                
                String exception_name = rs.getString(TableInfo.EXCEPTION_NAME);
                map.put (CallFlowMonitor.EXCEPTION_KEY, exception_name);
                
                long time_taken = rs.getLong(10);
                map.put (CallFlowMonitor.RESPONSE_TIME_KEY, String.valueOf(time_taken));
                if (traceOn){
                    logger.log(Level.INFO, "Callflow: getRequestInfo: ReqId ="+
                            request_id + " , appname = "+ app_name);
                }
                
                list.add(map);
            }
            
        } catch (SQLException se){
            // log it
            logger.log(Level.WARNING, "callflow.error_get_request_info");                                    
            logger.log(Level.FINE, "callflow.error_sql_execute", se);
        }
        closeConnection();
        return list;
    
private java.lang.StringgetTableWithServerName(java.lang.String oldTableName)

        if (serverName == null)
            serverName = reqStart.getServerInstanceName ();
        
        return oldTableName + serverName;
    
public booleaninsert(TransferObject[] transferObject)

        boolean result = false;
    
        if (transferObject.length == 0) //sanity
            return true; 
        
        if (transferObject[0] instanceof RequestStartTO){
            result =  
             (pstmtRS == null)? false: reqStart.insert(pstmtRS, transferObject);
        } else if (transferObject[0] instanceof RequestEndTO){
            result = 
              (pstmtRE == null)? false : reqEnd.insert(pstmtRE, transferObject);
        } else  if (transferObject[0] instanceof MethodStartTO){
           result = 
           (pstmtMS == null)? false : methStart.insert(pstmtMS, transferObject);
        } else if (transferObject[0] instanceof MethodEndTO){
            result =
             (pstmtME == null)? false : methEnd.insert(pstmtME, transferObject);
        } else if (transferObject[0] instanceof StartTimeTO){
	    result = 
		(pstmtST == null)? false : startTime.insert(pstmtST, transferObject);
	} else if (transferObject[0] instanceof EndTimeTO){
	    result = 
		(pstmtET == null)? false : endTime.insert(pstmtET, transferObject);
	}
        return result;
    
private booleansetupConnection()

      try{
               // TODO code application logic here
          boolean standaloneDb =
                  Boolean.valueOf(System.getProperty("callflow.db.standalone"));

          if (!standaloneDb) {

              InitialContext ic = new InitialContext ();
              DataSource ds = (DataSource)ic.lookup (CALLFLOW_POOL_JNDI_NAME);
              connection = ds.getConnection();
          } else {
            // TODO code application logic here
            String url="jdbc:derby://localhost:1527/sun-callflow;retrieveMessagesFromServerOnGetMessage=true;create=true;";            
            Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
            connection = DriverManager.getConnection(url, "APP", "APP");         
          }
        } catch (Exception e){
            logger.log(Level.INFO, "callflow.connection_obtain_failed", e);
            logger.log(Level.SEVERE, "callflow.enable_failed");            
            RuntimeException re = 
                    new RuntimeException ("Error obtaining connection to " +
                                    "callflow database. " +
                    "Is database started?. Refer logs for exact cause.", e.getCause());
            throw re;
        }        
        return true;