protected String buildRuntimeInfo(String indent, LocalizedResource localLangUtil) { String s = ""; s += indent + localLangUtil.getTextMessage("DRDA_RuntimeInfoSessionNumber.I") + connNum + "\n"; if (database == null) return s; s += database.buildRuntimeInfo(indent,localLangUtil); s += "\n"; return s; }
/** * Set connection and create the SQL statement for the default statement * * @param conn Connection * @exception SQLException */ final void setConnection(EngineConnection conn) throws SQLException { if (this.conn != conn) { // Need to drop the pb session data when switching connections pbsd_ = null; } this.conn = conn; if(conn != null) // GemStone changes BEGIN { checkAndSetPossibleNCJBatchSizeDuplicate(); checkAndSetPossibleNCJCacheSizeDuplicate(); checkAndSetPossibleDuplicate(); this.defaultStatement.setStatement(conn); } }
/** * Close session - close connection sockets and set state to closed * */ protected void close() throws SQLException { try { sessionInput.close(); sessionOutput.close(); clientSocket.close(); if (dbtable != null) for (Enumeration e = dbtable.elements() ; e.hasMoreElements() ;) { ((Database) e.nextElement()).close(); } }catch (IOException e) {} // ignore IOException when we are shutting down finally { state = CLOSED; dbtable = null; database = null; } }
protected final Statement implicitPrepare(String sqlStmt) throws SQLException { // save current prepare iso level int saveIsolationLevel = -1; boolean isolationSet = false; if (pkgnamcsn != null && isolationLevel != Connection.TRANSACTION_NONE) { saveIsolationLevel = database.getPrepareIsolation(); database.setPrepareIsolation(isolationLevel); isolationSet = true; } parsePkgidToFindHoldability(); pstmt = database.getConnection().createStatement(scrollType, concurType, withHoldCursor); this.sqlText = sqlStmt; // beetle 3849 - Need to change the cursor name to what // JCC thinks it will be, since there is no way in the // protocol to communicate the actual cursor name. JCC keeps // a mapping from the client cursor names to the DB2 style cursor names if (cursorName != null) { // cursorName not null means we are dealing // with dynamic packages pstmt.setCursorName(cursorName); } if (isolationSet) { database.setPrepareIsolation(saveIsolationLevel); } return pstmt; }
DRDAStatement currentStatement; currentStatement = database.getCurrentStatement(); if (currentStatement == null) currentStatement = database.getDefaultStatement(); currentStatement.initialize();
checkWarning(null, database.getDefaultStatement().getStatement(), null, updateCount, true, true); writePBSD(); PRPSQLSTTfailed = false; try { database.getConnection().clearWarnings(); sqldaType = parsePRPSQLSTT(); database.getCurrentStatement().sqldaType = sqldaType; database.getCurrentStatement(); currStmt.sqldaType = sqldaType; database.getConnection().getWarnings(), true,false); checkWarning(database.getConnection(), null, null, 0, true, true); stmt = database.getDRDAStatement(pkgnamcsn); database.getCurrentStatement(); if (batchStmt != null && batchStmt.batchOutput && if (!database.getConnection().getAutoCommit()) database.getConnection().clearWarnings(); database.commit(); writeENDUOWRM(COMMIT); checkWarning(database.getConnection(), null, null, 0, true, true);
if (this.trace) trace("******************************************drdaID is: " + session.drdaID); database.setDrdaID(session.drdaID); database.resetFlags(); memberId = reader.readLong(getByteOrder()); uniqueId = reader.readLong(getByteOrder()); EngineConnection conn = database.getConnection(); if (conn != null && ROLLBACK_IMPLEMENTED_FULLY) { GemFireTransaction gft = (GemFireTransaction)conn case CodePoint.NCJCACHESIZE: database.ncjCacheSize = parseNCJCACHESIZE(); database.checkAndSetPossibleNCJCacheSizeDuplicate(); break; case CodePoint.NCJBATCHSIZE: database.ncjBatchSize = parseNCJBATCHSIZE(); database.checkAndSetPossibleNCJBatchSizeDuplicate();
boolean needPrepareCall = false; stmt = database.getDRDAStatement(pkgnamcsn); if (SanityManager.TraceSingleHop) { SanityManager.DEBUG_PRINT(SanityManager.TRACE_SINGLE_HOP, stmt = database.newDRDAStatement(pkgnamcsn); stmt.setQryprctyp(CodePoint.QRYBLKCTL_DEFAULT); needPrepareCall = true; EngineConnection conn = database.getConnection(); Checkpoint cp = null; if (this.currTxIdForSHOPExecution != null) { database.setCurrentStatement(stmt); if (this.trace) trace ("$$$prepareCall is: "+prepareString); database.getConnection().clearWarnings(); CallableStatement cs = (CallableStatement) stmt.prepare(prepareString); checkWarning(database.getConnection(), stmt.getUnderlyingStatement(), null, updateCount, null, true, true);
private void setExecutionSequence(int execSeq) { assert this.database != null : "database expected to be non null"; EngineConnection conn = this.database.getConnection(); conn.setExecutionSequence(execSeq); } // GemStone changes BEGIN
/** * Get a new DRDA statement and store it in the stmtTable if stortStmt is * true. If possible recycle an existing statement. When the server gets a * new statement with a previously used pkgnamcsn, it means that * client-side statement associated with this pkgnamcsn has been closed. In * this case, server can re-use the DRDAStatement by doing the following: * 1) Retrieve the old DRDAStatement associated with this pkgnamcsn and * close it. * 2) Reset the DRDAStatement state for re-use. * * @param pkgnamcsn Package name and section * @return DRDAStatement */ protected DRDAStatement newDRDAStatement(Pkgnamcsn pkgnamcsn) throws SQLException { DRDAStatement stmt = getDRDAStatement(pkgnamcsn); if (stmt != null) { stmt.close(); stmt.reset(); } else { stmt = new DRDAStatement(this); stmt.setPkgnamcsn(pkgnamcsn); storeStatement(stmt); } return stmt; }
database.checkAndSetPossibleDuplicate(); } catch (SQLException sqle) { this.databaseAccessException = sqle; if(database.getConnection() == null && databaseAccessException == null){ writeRDBfailure(CodePoint.RDBAFLRM); return false;
DRDAStatement drdaStmt = database.getDefaultStatement(pkgnamcsn); } finally { this.database.getConnection().setPossibleDuplicate(false);
DRDAStatement stmt = database.getDRDAStatement(pkgnamcsn); EngineConnection conn = database.getConnection(); Checkpoint cp = null; if (this.currTxIdForSHOPExecution != null) {
private int getByteOrder() { DRDAStatement stmt = database.getCurrentStatement(); return ((stmt != null && stmt.typDefNam != null) ? stmt.byteOrder : database.byteOrder); }
DRDAStatement stmt = database.getDRDAStatement(pkgnamcsn); if (stmt == null)
/** * Add a database to the current session * */ private void addDatabase(String dbname) { Database db; if (appRequester.isXARequester()) { db = new XADatabase(dbname); } else db = new Database(dbname); session.addDatabase(db); session.database = db; database = db; } /**
/** * Commit local transaction. Send SYNCCRD response. * * @throws DRDAProtocolException */ private void commitLocalTransaction() throws DRDAProtocolException { int xaRetVal = XAResource.XA_OK; try { connThread.getDatabase().commit(); } catch (Exception e) { xaRetVal = XAException.XAER_RMFAIL; if (SanityManager.DEBUG) { connThread.getServer().consoleExceptionPrint(e); } } writeSYNCCRD(CodePoint.SYNCTYPE_COMMITTED, xaRetVal, null); }
checkWarning(null, database.getDefaultStatement().getStatement(), null, updateCount, true, true); writePBSD(); PRPSQLSTTfailed = false; try { database.getConnection().clearWarnings(); sqldaType = parsePRPSQLSTT(); database.getCurrentStatement().sqldaType = sqldaType; database.getCurrentStatement(); currStmt.sqldaType = sqldaType; database.getConnection().getWarnings(), true,false); checkWarning(database.getConnection(), null, null, 0, true, true); stmt = database.getDRDAStatement(pkgnamcsn); database.getCurrentStatement(); if (batchStmt != null && batchStmt.batchOutput && if (!database.getConnection().getAutoCommit()) database.getConnection().clearWarnings(); database.commit(); writeENDUOWRM(COMMIT); checkWarning(database.getConnection(), null, null, 0, true, true);
if (this.trace) trace("******************************************drdaID is: " + session.drdaID); database.setDrdaID(session.drdaID); database.resetFlags(); memberId = reader.readLong(getByteOrder()); uniqueId = reader.readLong(getByteOrder()); EngineConnection conn = database.getConnection(); if (conn != null && ROLLBACK_IMPLEMENTED_FULLY) { GemFireTransaction gft = (GemFireTransaction)conn case CodePoint.NCJCACHESIZE: database.ncjCacheSize = parseNCJCACHESIZE(); database.checkAndSetPossibleNCJCacheSizeDuplicate(); break; case CodePoint.NCJBATCHSIZE: database.ncjBatchSize = parseNCJBATCHSIZE(); database.checkAndSetPossibleNCJBatchSizeDuplicate();
protected final Statement implicitPrepare(String sqlStmt) throws SQLException { // save current prepare iso level int saveIsolationLevel = -1; boolean isolationSet = false; if (pkgnamcsn != null && isolationLevel != Connection.TRANSACTION_NONE) { saveIsolationLevel = database.getPrepareIsolation(); database.setPrepareIsolation(isolationLevel); isolationSet = true; } parsePkgidToFindHoldability(); pstmt = database.getConnection().createStatement(scrollType, concurType, withHoldCursor); this.sqlText = sqlStmt; // beetle 3849 - Need to change the cursor name to what // JCC thinks it will be, since there is no way in the // protocol to communicate the actual cursor name. JCC keeps // a mapping from the client cursor names to the DB2 style cursor names if (cursorName != null) { // cursorName not null means we are dealing // with dynamic packages pstmt.setCursorName(cursorName); } if (isolationSet) { database.setPrepareIsolation(saveIsolationLevel); } return pstmt; }