List of usage examples for java.sql CallableStatement close
void close() throws SQLException;
Statement
object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed. From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstOracle.CFAstOracleISOTimezoneTable.java
public void deleteISOTimezone(CFAstAuthorization Authorization, CFAstISOTimezoneBuff Buff) { final String S_ProcName = "deleteISOTimezone"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try {/*from www . j a va 2s .c o m*/ short ISOTimezoneId = Buff.getRequiredISOTimezoneId(); stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName() + ".dl_isotz( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByPKey.setShort(argIdx++, ISOTimezoneId); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; stmtDeleteByPKey.execute(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtDeleteByPKey != null) { try { stmtDeleteByPKey.close(); } catch (SQLException e) { } stmtDeleteByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstOracle.CFAstOracleISOTimezoneTable.java
public void deleteISOTimezone(CFAstAuthorization Authorization, CFAstISOTimezoneBuff Buff) { final String S_ProcName = "deleteISOTimezone"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try {//from w w w . j av a 2 s.co m short ISOTimezoneId = Buff.getRequiredISOTimezoneId(); stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".dl_isotz( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByPKey.setShort(argIdx++, ISOTimezoneId); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; stmtDeleteByPKey.execute(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtDeleteByPKey != null) { try { stmtDeleteByPKey.close(); } catch (SQLException e) { } stmtDeleteByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswOracle.CFFswOracleISOTimezoneTable.java
public void deleteISOTimezone(CFFswAuthorization Authorization, CFFswISOTimezoneBuff Buff) { final String S_ProcName = "deleteISOTimezone"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try {//from w w w. j a v a 2s . c o m short ISOTimezoneId = Buff.getRequiredISOTimezoneId(); stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".dl_isotz( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByPKey.setShort(argIdx++, ISOTimezoneId); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; stmtDeleteByPKey.execute(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtDeleteByPKey != null) { try { stmtDeleteByPKey.close(); } catch (SQLException e) { } stmtDeleteByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleISOTimezoneTable.java
public void deleteISOTimezone(CFEnSyntaxAuthorization Authorization, CFEnSyntaxISOTimezoneBuff Buff) { final String S_ProcName = "deleteISOTimezone"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try {/* ww w . jav a 2 s . c o m*/ short ISOTimezoneId = Buff.getRequiredISOTimezoneId(); stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".dl_isotz( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByPKey.setShort(argIdx++, ISOTimezoneId); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; stmtDeleteByPKey.execute(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtDeleteByPKey != null) { try { stmtDeleteByPKey.close(); } catch (SQLException e) { } stmtDeleteByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMSSql.CFEnSyntaxMSSqlSchema.java
public boolean isSystemUser(CFEnSyntaxAuthorization Authorization) { final String S_ProcName = "isSystemUser"; if (!inTransaction) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Not in a transaction"); }//from w ww .j av a 2 s . c om CallableStatement stmtSecurityCheck = null; try { final String sql = "exec sp_is_system_user ?, ?"; stmtSecurityCheck = cnx.prepareCall(sql); stmtSecurityCheck.registerOutParameter(1, java.sql.Types.INTEGER); stmtSecurityCheck.setString(2, Authorization.getSecUserId().toString()); stmtSecurityCheck.execute(); int isAuthorized = stmtSecurityCheck.getInt(1); if (isAuthorized == 0) { return (false); } else { return (true); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtSecurityCheck != null) { try { stmtSecurityCheck.close(); } catch (SQLException e) { } stmtSecurityCheck = null; } } }
From source file:com.cws.esolutions.security.dao.usermgmt.impl.SQLUserManager.java
/** * @see com.cws.esolutions.security.dao.usermgmt.interfaces.UserManager#listUserAccounts() */// w ww . j av a 2 s.c o m public synchronized List<String[]> listUserAccounts() throws UserManagementException { final String methodName = SQLUserManager.CNAME + "#listUserAccounts() throws UserManagementException"; if (DEBUG) { DEBUGGER.debug(methodName); } Connection sqlConn = null; ResultSet resultSet = null; CallableStatement stmt = null; List<String[]> results = null; try { sqlConn = SQLUserManager.dataSource.getConnection(); if (sqlConn.isClosed()) { throw new SQLException("Unable to obtain application datasource connection"); } sqlConn.setAutoCommit(true); stmt = sqlConn.prepareCall("{ CALL listUserAccounts() }"); if (DEBUG) { DEBUGGER.debug("CallableStatement: {}", stmt); } if (stmt.execute()) { resultSet = stmt.getResultSet(); if (resultSet.next()) { resultSet.beforeFirst(); results = new ArrayList<String[]>(); while (resultSet.next()) { String[] userData = new String[] { resultSet.getString("cn"), resultSet.getString("uid") }; if (DEBUG) { for (String str : userData) { DEBUGGER.debug(str); } } results.add(userData); } if (DEBUG) { DEBUGGER.debug("List: {}", results); } } } } catch (SQLException sqx) { throw new UserManagementException(sqx.getMessage(), sqx); } finally { try { if (resultSet != null) { resultSet.close(); } if (stmt != null) { stmt.close(); } if (!(sqlConn == null) && (!(sqlConn.isClosed()))) { sqlConn.close(); } } catch (SQLException sqx) { throw new UserManagementException(sqx.getMessage(), sqx); } } return results; }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmMSSql.CFCrmMSSqlSchema.java
public boolean isSystemUser(CFCrmAuthorization Authorization) { final String S_ProcName = "isSystemUser"; if (!inTransaction) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Not in a transaction"); }//from w w w. j a v a2 s .c o m CallableStatement stmtSecurityCheck = null; try { final String sql = "exec sp_is_system_user ?, ?"; stmtSecurityCheck = cnx.prepareCall(sql); stmtSecurityCheck.registerOutParameter(1, java.sql.Types.INTEGER); stmtSecurityCheck.setString(2, Authorization.getSecUserId().toString()); stmtSecurityCheck.execute(); int isAuthorized = stmtSecurityCheck.getInt(1); if (isAuthorized == 0) { return (false); } else { return (true); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtSecurityCheck != null) { try { stmtSecurityCheck.close(); } catch (SQLException e) { } stmtSecurityCheck = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java
public boolean isTenantUser(CFAstAuthorization Authorization, long tenantId, String secGroupName) { if (!inTransaction) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), "isTenantUser", "Not in a transaction"); }//from w w w .jav a 2s . c om CallableStatement stmtSecurityCheck = null; try { final String sql = "{ call sp_is_tenant_user( ?, ?, ?, ? ) }"; stmtSecurityCheck = cnx.prepareCall(sql); stmtSecurityCheck.registerOutParameter(1, java.sql.Types.INTEGER); stmtSecurityCheck.setLong(2, tenantId); stmtSecurityCheck.setString(3, secGroupName); stmtSecurityCheck.setString(4, Authorization.getSecUserId().toString()); stmtSecurityCheck.execute(); int isAuthorized = stmtSecurityCheck.getInt(1); if (isAuthorized == 0) { return (false); } else { return (true); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "isTenantUser", e); } finally { if (stmtSecurityCheck != null) { try { stmtSecurityCheck.close(); } catch (SQLException e) { } stmtSecurityCheck = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java
public boolean isClusterUser(CFAstAuthorization Authorization, long clusterId, String secGroupName) { if (!inTransaction) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), "isClusterUser", "Not in a transaction"); }//from w ww . j av a 2 s.c o m CallableStatement stmtSecurityCheck = null; try { final String sql = "{ call sp_is_cluster_user( ?, ?, ?, ? ) }"; stmtSecurityCheck = cnx.prepareCall(sql); stmtSecurityCheck.registerOutParameter(1, java.sql.Types.INTEGER); stmtSecurityCheck.setLong(2, clusterId); stmtSecurityCheck.setString(3, secGroupName); stmtSecurityCheck.setString(4, Authorization.getSecUserId().toString()); stmtSecurityCheck.execute(); int isAuthorized = stmtSecurityCheck.getInt(1); if (isAuthorized == 0) { return (false); } else { return (true); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "isClusterUser", e); } finally { if (stmtSecurityCheck != null) { try { stmtSecurityCheck.close(); } catch (SQLException e) { } stmtSecurityCheck = null; } } }
From source file:com.cws.esolutions.security.dao.usermgmt.impl.SQLUserManager.java
/** * @see com.cws.esolutions.security.dao.usermgmt.interfaces.UserManager#searchUsers(java.lang.String) *//*from w w w .j av a2s .c o m*/ public synchronized List<String[]> searchUsers(final String searchData) throws UserManagementException { final String methodName = SQLUserManager.CNAME + "#searchUsers(final String searchData) throws UserManagementException"; if (DEBUG) { DEBUGGER.debug(methodName); DEBUGGER.debug("Value: {}", searchData); } Connection sqlConn = null; ResultSet resultSet = null; CallableStatement stmt = null; List<String[]> results = null; try { sqlConn = SQLUserManager.dataSource.getConnection(); if (sqlConn.isClosed()) { throw new SQLException("Unable to obtain application datasource connection"); } sqlConn.setAutoCommit(true); stmt = sqlConn.prepareCall("{ CALL getUserByAttribute(?, ?) }"); stmt.setString(1, searchData); stmt.setInt(2, 0); if (DEBUG) { DEBUGGER.debug("CallableStatement: {}", stmt); } if (stmt.execute()) { resultSet = stmt.getResultSet(); if (resultSet.next()) { resultSet.beforeFirst(); results = new ArrayList<String[]>(); while (resultSet.next()) { String[] userData = new String[] { resultSet.getString("cn"), resultSet.getString("uid") }; if (DEBUG) { DEBUGGER.debug("Data: {}", (Object) userData); } results.add(userData); } if (DEBUG) { DEBUGGER.debug("List: {}", results); } } } } catch (SQLException sqx) { throw new UserManagementException(sqx.getMessage(), sqx); } finally { try { if (resultSet != null) { resultSet.close(); } if (stmt != null) { stmt.close(); } if (!(sqlConn == null) && (!(sqlConn.isClosed()))) { sqlConn.close(); } } catch (SQLException sqx) { throw new UserManagementException(sqx.getMessage(), sqx); } } return results; }