Example usage for java.sql Connection TRANSACTION_REPEATABLE_READ

List of usage examples for java.sql Connection TRANSACTION_REPEATABLE_READ

Introduction

In this page you can find the example usage for java.sql Connection TRANSACTION_REPEATABLE_READ.

Prototype

int TRANSACTION_REPEATABLE_READ

To view the source code for java.sql Connection TRANSACTION_REPEATABLE_READ.

Click Source Link

Document

A constant indicating that dirty reads and non-repeatable reads are prevented; phantom reads can occur.

Usage

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstPgSql.CFAstPgSqlSchema.java

public boolean connect() {
    final String S_ProcName = "connect";
    if (cnx != null) {
        return (false);
    }//  www.jav a 2s  .  c  om

    if (configuration != null) {
        String dbServer = configuration.getDbServer();
        int dbPort = configuration.getDbPort();
        String dbDatabase = configuration.getDbDatabase();
        String dbUserName = configuration.getDbUserName();
        String dbPassword = configuration.getDbPassword();
        String url = "jdbc:postgresql://" + dbServer + ":" + Integer.toString(dbPort) + "/" + dbDatabase;
        Properties props = new Properties();
        props.setProperty("user", dbUserName);
        props.setProperty("password", dbPassword);
        try {
            cnx = DriverManager.getConnection(url, props);
            cnx.setAutoCommit(false);
            cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
            cnx.rollback();
            setDbSchemaName(dbDatabase);
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        return (true);
    }
    if (jndiName != null) {
        try {
            Context ctx = new InitialContext();
            DataSource ds = (DataSource) ctx.lookup(jndiName);
            if (ds == null) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Could not get resolve DataSource \"" + jndiName + "\"");
            }
            cnx = ds.getConnection();
            if (cnx == null) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Could not get Connection from PooledConnection for ConnectionPoolDataSource \""
                                + jndiName + "\"");
            }
            cnx.setAutoCommit(false);
            cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
            cnx.rollback();
        } catch (NamingException e) {
            cnx = null;
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "NamingException " + e.getMessage(), e);
        } catch (SQLException e) {
            cnx = null;
            inTransaction = false;
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        return (true);
    }
    throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
            "Neither configurationFile nor jndiName found, do not know how to connect to database");
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_2.CFAstMySql.CFAstMySqlSchema.java

public CFAstMySqlSchema(Connection argCnx) {
    super();//from   ww  w  .ja  va  2s  .c om
    cnx = argCnx;
    inTransaction = false;
    tableAsteriskConf = new CFAstMySqlAsteriskConfTable(this);
    tableAuditAction = new CFAstMySqlAuditActionTable(this);
    tableCluster = new CFAstMySqlClusterTable(this);
    tableConfigurationFile = new CFAstMySqlConfigurationFileTable(this);
    tableDomain = new CFAstMySqlDomainTable(this);
    tableDomainBase = new CFAstMySqlDomainBaseTable(this);
    tableExtConfigConf = new CFAstMySqlExtConfigConfTable(this);
    tableExtensionsConf = new CFAstMySqlExtensionsConfTable(this);
    tableHostNode = new CFAstMySqlHostNodeTable(this);
    tableISOCountry = new CFAstMySqlISOCountryTable(this);
    tableISOCountryCurrency = new CFAstMySqlISOCountryCurrencyTable(this);
    tableISOCountryLanguage = new CFAstMySqlISOCountryLanguageTable(this);
    tableISOCurrency = new CFAstMySqlISOCurrencyTable(this);
    tableISOLanguage = new CFAstMySqlISOLanguageTable(this);
    tableISOTimezone = new CFAstMySqlISOTimezoneTable(this);
    tableMajorVersion = new CFAstMySqlMajorVersionTable(this);
    tableMimeType = new CFAstMySqlMimeTypeTable(this);
    tableMinorVersion = new CFAstMySqlMinorVersionTable(this);
    tableProjectBase = new CFAstMySqlProjectBaseTable(this);
    tableRealProject = new CFAstMySqlRealProjectTable(this);
    tableSecApp = new CFAstMySqlSecAppTable(this);
    tableSecDevice = new CFAstMySqlSecDeviceTable(this);
    tableSecForm = new CFAstMySqlSecFormTable(this);
    tableSecGroup = new CFAstMySqlSecGroupTable(this);
    tableSecGroupForm = new CFAstMySqlSecGroupFormTable(this);
    tableSecGroupInclude = new CFAstMySqlSecGroupIncludeTable(this);
    tableSecGroupMember = new CFAstMySqlSecGroupMemberTable(this);
    tableSecSession = new CFAstMySqlSecSessionTable(this);
    tableSecUser = new CFAstMySqlSecUserTable(this);
    tableService = new CFAstMySqlServiceTable(this);
    tableServiceType = new CFAstMySqlServiceTypeTable(this);
    tableSipConf = new CFAstMySqlSipConfTable(this);
    tableSubProject = new CFAstMySqlSubProjectTable(this);
    tableSysCluster = new CFAstMySqlSysClusterTable(this);
    tableTSecGroup = new CFAstMySqlTSecGroupTable(this);
    tableTSecGroupInclude = new CFAstMySqlTSecGroupIncludeTable(this);
    tableTSecGroupMember = new CFAstMySqlTSecGroupMemberTable(this);
    tableTenant = new CFAstMySqlTenantTable(this);
    tableTld = new CFAstMySqlTldTable(this);
    tableTopDomain = new CFAstMySqlTopDomainTable(this);
    tableTopProject = new CFAstMySqlTopProjectTable(this);
    tableURLProtocol = new CFAstMySqlURLProtocolTable(this);
    tableVersion = new CFAstMySqlVersionTable(this);
    tableVoicemailConf = new CFAstMySqlVoicemailConfTable(this);
    try {
        cnx.setAutoCommit(false);
        cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
        cnx.rollback();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "CFAstMySqlSchema-constructor", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstMSSql.CFAstMSSqlSchema.java

public boolean connect() {
    final String S_ProcName = "connect";
    if (cnx != null) {
        return (false);
    }//from   w  ww  .  j  a  v a 2s .com

    if (configuration != null) {
        try {
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
        } catch (ClassNotFoundException e) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), "connect",
                    "Could not load MS SQL Server 2012 Express Advanced Edition driver", e);
        }
        String dbServer = configuration.getDbServer();
        int dbPort = configuration.getDbPort();
        String dbDatabase = configuration.getDbDatabase();
        String dbUserName = configuration.getDbUserName();
        String dbPassword = configuration.getDbPassword();
        String url = "jdbc:sqlserver://" + dbServer + ":" + Integer.toString(dbPort) + ";";
        Properties props = new Properties();
        props.setProperty("user", dbUserName);
        props.setProperty("password", dbPassword);
        try {
            cnx = DriverManager.getConnection(url, props);
            cnx.setAutoCommit(false);
            cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
            cnx.rollback();
            setDbSchemaName(dbDatabase);
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName + "<<connect>>", e);
        }
        Statement stmtUseDatabase = null;
        try {
            stmtUseDatabase = cnx.createStatement();
            stmtUseDatabase.executeUpdate("use " + dbDatabase);
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName + "<<useDatabase>>",
                    e);
        } finally {
            if (stmtUseDatabase != null) {
                try {
                    stmtUseDatabase.close();
                } catch (SQLException e) {
                }
                stmtUseDatabase = null;
            }
        }
        return (true);
    }
    if (jndiName != null) {
        try {
            Context ctx = new InitialContext();
            DataSource ds = (DataSource) ctx.lookup(jndiName);
            if (ds == null) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Could not get resolve DataSource \"" + jndiName + "\"");
            }
            cnx = ds.getConnection();
            if (cnx == null) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Could not get Connection from PooledConnection for ConnectionPoolDataSource \""
                                + jndiName + "\"");
            }
            cnx.setAutoCommit(false);
            cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
            cnx.rollback();
        } catch (NamingException e) {
            cnx = null;
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(),
                    S_ProcName + "<<jndiGetConnection>>", "NamingException " + e.getMessage(), e);
        } catch (SQLException e) {
            cnx = null;
            inTransaction = false;
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(),
                    S_ProcName + "<<jndiGetConnection>>", e);
        }
        return (true);
    }
    throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
            "Neither configurationFile nor jndiName found, do not know how to connect to database");
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java

public boolean connect() {
    final String S_ProcName = "connect";
    if (cnx != null) {
        return (false);
    }// w  w w  . java  2  s .  com

    if (configuration != null) {
        try {
            Class.forName("com.sybase.jdbc4.jdbc.SybDriver");
        } catch (ClassNotFoundException e) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), "connect",
                    "Could not load Sybase ASE 15.7 driver", e);
        }
        String dbServer = configuration.getDbServer();
        int dbPort = configuration.getDbPort();
        String dbDatabase = configuration.getDbDatabase();
        String dbUserName = configuration.getDbUserName();
        String dbPassword = configuration.getDbPassword();
        String url = "jdbc:sybase:Tds:" + dbServer + ":" + Integer.toString(dbPort);
        Properties props = new Properties();
        props.setProperty("user", dbUserName);
        props.setProperty("password", dbPassword);
        try {
            cnx = DriverManager.getConnection(url, props);
            cnx.setAutoCommit(false);
            cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
            cnx.rollback();
            setDbSchemaName(dbDatabase);
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName + "<<connect>>", e);
        }
        Statement stmtUseDatabase = null;
        try {
            stmtUseDatabase = cnx.createStatement();
            stmtUseDatabase.executeUpdate("use " + dbDatabase);
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName + "<<useDatabase>>",
                    e);
        } finally {
            if (stmtUseDatabase != null) {
                try {
                    stmtUseDatabase.close();
                } catch (SQLException e) {
                }
                stmtUseDatabase = null;
            }
        }
        Statement stmtSetChainedOff = null;
        try {
            stmtSetChainedOff = cnx.createStatement();
            stmtSetChainedOff.executeUpdate("set chained off");
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(),
                    S_ProcName + "<<setChainedOff>>", e);
        } finally {
            if (stmtSetChainedOff != null) {
                try {
                    stmtSetChainedOff.close();
                } catch (SQLException e) {
                }
                stmtSetChainedOff = null;
            }
        }
        return (true);
    }
    if (jndiName != null) {
        try {
            Context ctx = new InitialContext();
            DataSource ds = (DataSource) ctx.lookup(jndiName);
            if (ds == null) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Could not get resolve DataSource \"" + jndiName + "\"");
            }
            cnx = ds.getConnection();
            if (cnx == null) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Could not get Connection from PooledConnection for ConnectionPoolDataSource \""
                                + jndiName + "\"");
            }
            cnx.setAutoCommit(false);
            cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
            cnx.rollback();
        } catch (NamingException e) {
            cnx = null;
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(),
                    S_ProcName + "<<jndiGetConnection>>", "NamingException " + e.getMessage(), e);
        } catch (SQLException e) {
            cnx = null;
            inTransaction = false;
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(),
                    S_ProcName + "<<jndiGetConnection>>", e);
        }
        return (true);
    }
    throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
            "Neither configurationFile nor jndiName found, do not know how to connect to database");
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstDb2LUW.CFAstDb2LUWSchema.java

public boolean connect() {
    final String S_ProcName = "connect";
    if (cnx != null) {
        return (false);
    }/*from www  .  j  a  v a 2  s.c  om*/

    if (configuration != null) {
        try {
            Class.forName("com.ibm.db2.jcc.DB2Driver");
        } catch (ClassNotFoundException e) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), "connect",
                    "Could not load IBM DB/2 LUW 10.5 driver", e);
        }
        String dbServer = configuration.getDbServer();
        int dbPort = configuration.getDbPort();
        String dbDatabase = configuration.getDbDatabase();
        String dbUserName = configuration.getDbUserName();
        String dbPassword = configuration.getDbPassword();
        String url = "jdbc:db2://" + dbServer + ":" + Integer.toString(dbPort) + "/" + dbDatabase;
        Properties props = new Properties();
        props.setProperty("user", dbUserName);
        props.setProperty("password", dbPassword);
        try {
            cnx = DriverManager.getConnection(url, props);
            cnx.setAutoCommit(false);
            cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
            cnx.rollback();
            setDbSchemaName(dbDatabase);
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        return (true);
    }
    if (jndiName != null) {
        try {
            Context ctx = new InitialContext();
            DataSource ds = (DataSource) ctx.lookup(jndiName);
            if (ds == null) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Could not get resolve DataSource \"" + jndiName + "\"");
            }
            cnx = ds.getConnection();
            if (cnx == null) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Could not get Connection from PooledConnection for ConnectionPoolDataSource \""
                                + jndiName + "\"");
            }
            cnx.setAutoCommit(false);
            cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
            cnx.rollback();
        } catch (NamingException e) {
            cnx = null;
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "NamingException " + e.getMessage(), e);
        } catch (SQLException e) {
            cnx = null;
            inTransaction = false;
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        return (true);
    }
    throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
            "Neither configurationFile nor jndiName found, do not know how to connect to database");
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccPgSql.CFAccPgSqlSchema.java

public CFAccPgSqlSchema(Connection argCnx) {
    super();/* ww w.  j av  a2  s . c  om*/
    cnx = argCnx;
    inTransaction = false;
    tableAccount = new CFAccPgSqlAccountTable(this);
    tableAccountConfig = new CFAccPgSqlAccountConfigTable(this);
    tableAccountContact = new CFAccPgSqlAccountContactTable(this);
    tableAccountEntry = new CFAccPgSqlAccountEntryTable(this);
    tableAddress = new CFAccPgSqlAddressTable(this);
    tableAddressTag = new CFAccPgSqlAddressTagTable(this);
    tableAttachment = new CFAccPgSqlAttachmentTable(this);
    tableAttachmentTag = new CFAccPgSqlAttachmentTagTable(this);
    tableAuditAction = new CFAccPgSqlAuditActionTable(this);
    tableCluster = new CFAccPgSqlClusterTable(this);
    tableContact = new CFAccPgSqlContactTable(this);
    tableContactList = new CFAccPgSqlContactListTable(this);
    tableContactTag = new CFAccPgSqlContactTagTable(this);
    tableContactURL = new CFAccPgSqlContactURLTable(this);
    tableDomain = new CFAccPgSqlDomainTable(this);
    tableDomainBase = new CFAccPgSqlDomainBaseTable(this);
    tableHostNode = new CFAccPgSqlHostNodeTable(this);
    tableISOCountry = new CFAccPgSqlISOCountryTable(this);
    tableISOCountryCurrency = new CFAccPgSqlISOCountryCurrencyTable(this);
    tableISOCountryLanguage = new CFAccPgSqlISOCountryLanguageTable(this);
    tableISOCurrency = new CFAccPgSqlISOCurrencyTable(this);
    tableISOLanguage = new CFAccPgSqlISOLanguageTable(this);
    tableISOTimezone = new CFAccPgSqlISOTimezoneTable(this);
    tableMajorVersion = new CFAccPgSqlMajorVersionTable(this);
    tableMemo = new CFAccPgSqlMemoTable(this);
    tableMemoTag = new CFAccPgSqlMemoTagTable(this);
    tableMimeType = new CFAccPgSqlMimeTypeTable(this);
    tableMinorVersion = new CFAccPgSqlMinorVersionTable(this);
    tablePhone = new CFAccPgSqlPhoneTable(this);
    tablePhoneTag = new CFAccPgSqlPhoneTagTable(this);
    tableProjectBase = new CFAccPgSqlProjectBaseTable(this);
    tableRealProject = new CFAccPgSqlRealProjectTable(this);
    tableSecApp = new CFAccPgSqlSecAppTable(this);
    tableSecForm = new CFAccPgSqlSecFormTable(this);
    tableSecGroup = new CFAccPgSqlSecGroupTable(this);
    tableSecGroupForm = new CFAccPgSqlSecGroupFormTable(this);
    tableSecGroupInclude = new CFAccPgSqlSecGroupIncludeTable(this);
    tableSecGroupMember = new CFAccPgSqlSecGroupMemberTable(this);
    tableSecSession = new CFAccPgSqlSecSessionTable(this);
    tableSecUser = new CFAccPgSqlSecUserTable(this);
    tableService = new CFAccPgSqlServiceTable(this);
    tableServiceType = new CFAccPgSqlServiceTypeTable(this);
    tableSubProject = new CFAccPgSqlSubProjectTable(this);
    tableTSecGroup = new CFAccPgSqlTSecGroupTable(this);
    tableTSecGroupInclude = new CFAccPgSqlTSecGroupIncludeTable(this);
    tableTSecGroupMember = new CFAccPgSqlTSecGroupMemberTable(this);
    tableTag = new CFAccPgSqlTagTable(this);
    tableTenant = new CFAccPgSqlTenantTable(this);
    tableTld = new CFAccPgSqlTldTable(this);
    tableTopDomain = new CFAccPgSqlTopDomainTable(this);
    tableTopProject = new CFAccPgSqlTopProjectTable(this);
    tableURLProtocol = new CFAccPgSqlURLProtocolTable(this);
    tableVersion = new CFAccPgSqlVersionTable(this);
    try {
        cnx.setAutoCommit(false);
        cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
        cnx.rollback();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "CFAccPgSqlSchema-constructor", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWSchema.java

public CFAccDb2LUWSchema(Connection argCnx) {
    super();//from  w w  w .  j  a v  a2  s  .c o  m
    cnx = argCnx;
    inTransaction = false;
    tableAccount = new CFAccDb2LUWAccountTable(this);
    tableAccountConfig = new CFAccDb2LUWAccountConfigTable(this);
    tableAccountContact = new CFAccDb2LUWAccountContactTable(this);
    tableAccountEntry = new CFAccDb2LUWAccountEntryTable(this);
    tableAddress = new CFAccDb2LUWAddressTable(this);
    tableAddressTag = new CFAccDb2LUWAddressTagTable(this);
    tableAttachment = new CFAccDb2LUWAttachmentTable(this);
    tableAttachmentTag = new CFAccDb2LUWAttachmentTagTable(this);
    tableAuditAction = new CFAccDb2LUWAuditActionTable(this);
    tableCluster = new CFAccDb2LUWClusterTable(this);
    tableContact = new CFAccDb2LUWContactTable(this);
    tableContactList = new CFAccDb2LUWContactListTable(this);
    tableContactTag = new CFAccDb2LUWContactTagTable(this);
    tableContactURL = new CFAccDb2LUWContactURLTable(this);
    tableDomain = new CFAccDb2LUWDomainTable(this);
    tableDomainBase = new CFAccDb2LUWDomainBaseTable(this);
    tableHostNode = new CFAccDb2LUWHostNodeTable(this);
    tableISOCountry = new CFAccDb2LUWISOCountryTable(this);
    tableISOCountryCurrency = new CFAccDb2LUWISOCountryCurrencyTable(this);
    tableISOCountryLanguage = new CFAccDb2LUWISOCountryLanguageTable(this);
    tableISOCurrency = new CFAccDb2LUWISOCurrencyTable(this);
    tableISOLanguage = new CFAccDb2LUWISOLanguageTable(this);
    tableISOTimezone = new CFAccDb2LUWISOTimezoneTable(this);
    tableMajorVersion = new CFAccDb2LUWMajorVersionTable(this);
    tableMemo = new CFAccDb2LUWMemoTable(this);
    tableMemoTag = new CFAccDb2LUWMemoTagTable(this);
    tableMimeType = new CFAccDb2LUWMimeTypeTable(this);
    tableMinorVersion = new CFAccDb2LUWMinorVersionTable(this);
    tablePhone = new CFAccDb2LUWPhoneTable(this);
    tablePhoneTag = new CFAccDb2LUWPhoneTagTable(this);
    tableProjectBase = new CFAccDb2LUWProjectBaseTable(this);
    tableRealProject = new CFAccDb2LUWRealProjectTable(this);
    tableSecApp = new CFAccDb2LUWSecAppTable(this);
    tableSecForm = new CFAccDb2LUWSecFormTable(this);
    tableSecGroup = new CFAccDb2LUWSecGroupTable(this);
    tableSecGroupForm = new CFAccDb2LUWSecGroupFormTable(this);
    tableSecGroupInclude = new CFAccDb2LUWSecGroupIncludeTable(this);
    tableSecGroupMember = new CFAccDb2LUWSecGroupMemberTable(this);
    tableSecSession = new CFAccDb2LUWSecSessionTable(this);
    tableSecUser = new CFAccDb2LUWSecUserTable(this);
    tableService = new CFAccDb2LUWServiceTable(this);
    tableServiceType = new CFAccDb2LUWServiceTypeTable(this);
    tableSubProject = new CFAccDb2LUWSubProjectTable(this);
    tableTSecGroup = new CFAccDb2LUWTSecGroupTable(this);
    tableTSecGroupInclude = new CFAccDb2LUWTSecGroupIncludeTable(this);
    tableTSecGroupMember = new CFAccDb2LUWTSecGroupMemberTable(this);
    tableTag = new CFAccDb2LUWTagTable(this);
    tableTenant = new CFAccDb2LUWTenantTable(this);
    tableTld = new CFAccDb2LUWTldTable(this);
    tableTopDomain = new CFAccDb2LUWTopDomainTable(this);
    tableTopProject = new CFAccDb2LUWTopProjectTable(this);
    tableURLProtocol = new CFAccDb2LUWURLProtocolTable(this);
    tableVersion = new CFAccDb2LUWVersionTable(this);
    try {
        cnx.setAutoCommit(false);
        cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
        cnx.rollback();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "CFAccDb2LUWSchema-constructor", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstMySql.CFAstMySqlSchema.java

public boolean connect() {
    final String S_ProcName = "connect";
    if (cnx != null) {
        return (false);
    }/*from  ww  w  .  j  a v a 2s . c om*/

    if (configuration != null) {
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), "connect",
                    "Could not load MySql 5.5 JDBC driver", e);
        }
        String dbServer = configuration.getDbServer();
        int dbPort = configuration.getDbPort();
        String dbDatabase = configuration.getDbDatabase();
        String dbUserName = configuration.getDbUserName();
        String dbPassword = configuration.getDbPassword();
        String url = "jdbc:mysql://" + dbServer + ":" + Integer.toString(dbPort) + "/" + dbDatabase;
        Properties props = new Properties();
        props.setProperty("user", dbUserName);
        props.setProperty("password", dbPassword);
        try {
            cnx = DriverManager.getConnection(url, props);
            cnx.setAutoCommit(false);
            cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
            cnx.rollback();
            setDbSchemaName(dbDatabase);
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        return (true);
    }
    if (jndiName != null) {
        try {
            Context ctx = new InitialContext();
            DataSource ds = (DataSource) ctx.lookup(jndiName);
            if (ds == null) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Could not get resolve DataSource \"" + jndiName + "\"");
            }
            cnx = ds.getConnection();
            if (cnx == null) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Could not get Connection from PooledConnection for ConnectionPoolDataSource \""
                                + jndiName + "\"");
            }
            cnx.setAutoCommit(false);
            cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
            cnx.rollback();
        } catch (NamingException e) {
            cnx = null;
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "NamingException " + e.getMessage(), e);
        } catch (SQLException e) {
            cnx = null;
            inTransaction = false;
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        return (true);
    }
    throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
            "Neither configurationFile nor jndiName found, do not know how to connect to database");
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswMySql.CFFswMySqlSchema.java

public CFFswMySqlSchema(Connection argCnx) {
    super();//from   w ww . j  a v a 2  s.c  o m
    cnx = argCnx;
    inTransaction = false;
    tableAuditAction = new CFFswMySqlAuditActionTable(this);
    tableCluster = new CFFswMySqlClusterTable(this);
    tableDomain = new CFFswMySqlDomainTable(this);
    tableDomainBase = new CFFswMySqlDomainBaseTable(this);
    tableFSSFConference = new CFFswMySqlFSSFConferenceTable(this);
    tableFSSFConferenceProfile = new CFFswMySqlFSSFConferenceProfileTable(this);
    tableFSSFDialer = new CFFswMySqlFSSFDialerTable(this);
    tableFSSFDialplan = new CFFswMySqlFSSFDialplanTable(this);
    tableFSSFDirectory = new CFFswMySqlFSSFDirectoryTable(this);
    tableFSSFExtension = new CFFswMySqlFSSFExtensionTable(this);
    tableFSSFGateway = new CFFswMySqlFSSFGatewayTable(this);
    tableFSSFProfile = new CFFswMySqlFSSFProfileTable(this);
    tableFSSFProfileAlias = new CFFswMySqlFSSFProfileAliasTable(this);
    tableFSSFProfileDomain = new CFFswMySqlFSSFProfileDomainTable(this);
    tableFSSFVMail = new CFFswMySqlFSSFVMailTable(this);
    tableFSSofia = new CFFswMySqlFSSofiaTable(this);
    tableHostNode = new CFFswMySqlHostNodeTable(this);
    tableISOCountry = new CFFswMySqlISOCountryTable(this);
    tableISOCountryCurrency = new CFFswMySqlISOCountryCurrencyTable(this);
    tableISOCountryLanguage = new CFFswMySqlISOCountryLanguageTable(this);
    tableISOCurrency = new CFFswMySqlISOCurrencyTable(this);
    tableISOLanguage = new CFFswMySqlISOLanguageTable(this);
    tableISOTimezone = new CFFswMySqlISOTimezoneTable(this);
    tableMajorVersion = new CFFswMySqlMajorVersionTable(this);
    tableMimeType = new CFFswMySqlMimeTypeTable(this);
    tableMinorVersion = new CFFswMySqlMinorVersionTable(this);
    tablePbxIvrMenu = new CFFswMySqlPbxIvrMenuTable(this);
    tablePbxIvrMenuEntry = new CFFswMySqlPbxIvrMenuEntryTable(this);
    tableProjectBase = new CFFswMySqlProjectBaseTable(this);
    tableRealProject = new CFFswMySqlRealProjectTable(this);
    tableSecApp = new CFFswMySqlSecAppTable(this);
    tableSecDevice = new CFFswMySqlSecDeviceTable(this);
    tableSecForm = new CFFswMySqlSecFormTable(this);
    tableSecGroup = new CFFswMySqlSecGroupTable(this);
    tableSecGroupForm = new CFFswMySqlSecGroupFormTable(this);
    tableSecGroupInclude = new CFFswMySqlSecGroupIncludeTable(this);
    tableSecGroupMember = new CFFswMySqlSecGroupMemberTable(this);
    tableSecSession = new CFFswMySqlSecSessionTable(this);
    tableSecUser = new CFFswMySqlSecUserTable(this);
    tableService = new CFFswMySqlServiceTable(this);
    tableServiceType = new CFFswMySqlServiceTypeTable(this);
    tableSubProject = new CFFswMySqlSubProjectTable(this);
    tableTSecGroup = new CFFswMySqlTSecGroupTable(this);
    tableTSecGroupInclude = new CFFswMySqlTSecGroupIncludeTable(this);
    tableTSecGroupMember = new CFFswMySqlTSecGroupMemberTable(this);
    tableTenant = new CFFswMySqlTenantTable(this);
    tableTld = new CFFswMySqlTldTable(this);
    tableTopDomain = new CFFswMySqlTopDomainTable(this);
    tableTopProject = new CFFswMySqlTopProjectTable(this);
    tableURLProtocol = new CFFswMySqlURLProtocolTable(this);
    tableVersion = new CFFswMySqlVersionTable(this);
    try {
        cnx.setAutoCommit(false);
        cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
        cnx.rollback();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "CFFswMySqlSchema-constructor", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMySql.CFAccMySqlSchema.java

public CFAccMySqlSchema(Connection argCnx) {
    super();/*from  w w w.  j a  v a 2 s .c  o m*/
    cnx = argCnx;
    inTransaction = false;
    tableAccount = new CFAccMySqlAccountTable(this);
    tableAccountConfig = new CFAccMySqlAccountConfigTable(this);
    tableAccountContact = new CFAccMySqlAccountContactTable(this);
    tableAccountEntry = new CFAccMySqlAccountEntryTable(this);
    tableAddress = new CFAccMySqlAddressTable(this);
    tableAddressTag = new CFAccMySqlAddressTagTable(this);
    tableAttachment = new CFAccMySqlAttachmentTable(this);
    tableAttachmentTag = new CFAccMySqlAttachmentTagTable(this);
    tableAuditAction = new CFAccMySqlAuditActionTable(this);
    tableCluster = new CFAccMySqlClusterTable(this);
    tableContact = new CFAccMySqlContactTable(this);
    tableContactList = new CFAccMySqlContactListTable(this);
    tableContactTag = new CFAccMySqlContactTagTable(this);
    tableContactURL = new CFAccMySqlContactURLTable(this);
    tableDomain = new CFAccMySqlDomainTable(this);
    tableDomainBase = new CFAccMySqlDomainBaseTable(this);
    tableHostNode = new CFAccMySqlHostNodeTable(this);
    tableISOCountry = new CFAccMySqlISOCountryTable(this);
    tableISOCountryCurrency = new CFAccMySqlISOCountryCurrencyTable(this);
    tableISOCountryLanguage = new CFAccMySqlISOCountryLanguageTable(this);
    tableISOCurrency = new CFAccMySqlISOCurrencyTable(this);
    tableISOLanguage = new CFAccMySqlISOLanguageTable(this);
    tableISOTimezone = new CFAccMySqlISOTimezoneTable(this);
    tableMajorVersion = new CFAccMySqlMajorVersionTable(this);
    tableMemo = new CFAccMySqlMemoTable(this);
    tableMemoTag = new CFAccMySqlMemoTagTable(this);
    tableMimeType = new CFAccMySqlMimeTypeTable(this);
    tableMinorVersion = new CFAccMySqlMinorVersionTable(this);
    tablePhone = new CFAccMySqlPhoneTable(this);
    tablePhoneTag = new CFAccMySqlPhoneTagTable(this);
    tableProjectBase = new CFAccMySqlProjectBaseTable(this);
    tableRealProject = new CFAccMySqlRealProjectTable(this);
    tableSecApp = new CFAccMySqlSecAppTable(this);
    tableSecForm = new CFAccMySqlSecFormTable(this);
    tableSecGroup = new CFAccMySqlSecGroupTable(this);
    tableSecGroupForm = new CFAccMySqlSecGroupFormTable(this);
    tableSecGroupInclude = new CFAccMySqlSecGroupIncludeTable(this);
    tableSecGroupMember = new CFAccMySqlSecGroupMemberTable(this);
    tableSecSession = new CFAccMySqlSecSessionTable(this);
    tableSecUser = new CFAccMySqlSecUserTable(this);
    tableService = new CFAccMySqlServiceTable(this);
    tableServiceType = new CFAccMySqlServiceTypeTable(this);
    tableSubProject = new CFAccMySqlSubProjectTable(this);
    tableTSecGroup = new CFAccMySqlTSecGroupTable(this);
    tableTSecGroupInclude = new CFAccMySqlTSecGroupIncludeTable(this);
    tableTSecGroupMember = new CFAccMySqlTSecGroupMemberTable(this);
    tableTag = new CFAccMySqlTagTable(this);
    tableTenant = new CFAccMySqlTenantTable(this);
    tableTld = new CFAccMySqlTldTable(this);
    tableTopDomain = new CFAccMySqlTopDomainTable(this);
    tableTopProject = new CFAccMySqlTopProjectTable(this);
    tableURLProtocol = new CFAccMySqlURLProtocolTable(this);
    tableVersion = new CFAccMySqlVersionTable(this);
    try {
        cnx.setAutoCommit(false);
        cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
        cnx.rollback();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "CFAccMySqlSchema-constructor", e);
    }
}