Пример #1
0
JNIEXPORT void JNICALL Java_org_trafodion_jdbc_t2_SQLMXStatement_executeDirect
(JNIEnv *jenv, jobject jobj, jstring server, jlong dialogueId, jint txid, jboolean autoCommit, jint txnMode,
 jstring stmtLabel, jstring cursorName, jstring sql, jboolean isSelect, jint queryTimeout,
 jint holdability, jobject resultSet, jlong currentStmtId)
{
    FUNCTION_ENTRY_LEVEL(DEBUG_LEVEL_STMT,"Java_org_trafodion_jdbc_t2_SQLMXStatement_executeDirect",
                         ("... dialogueId=0x%08x, txid=%ld, autoCommit=%s, stmtLabel=%s, cursorName=%s, sql=%s, txnMode=%ld, isSelect=%s, holdability=%ld, resultSet=0x%08x",
                          dialogueId,
                          txid,
                          DebugBoolStr(autoCommit),
                          DebugJString(jenv,stmtLabel),
                          DebugJString(jenv,cursorName),
                          DebugJString(jenv,sql),
                          txnMode,
                          DebugBoolStr(isSelect),
                          holdability,
                          resultSet));

    ExceptionStruct				exception_;
    long					estimatedCost;
    long					rowsAffected;
    ERROR_DESC_LIST_def			sqlWarning;
    SQLItemDescList_def			outputDesc;
    jint						currentTxid = txid;
    jint						externalTxid = 0;
    long						stmtId;

    const char		*nSql;
    const char		*nStmtLabel;
    const char		*nCursorName;
    jbyteArray		sqlByteArray;
    jboolean		isCopy;
    jsize			len;
    SQLValue_def	sqlString;
    short			txn_status;

    sqlString.dataCharset = 0;
    sqlString.dataInd = 0;
    sqlString.dataType = SQLTYPECODE_VARCHAR;

    if (sql)
    {
        if ((sqlByteArray = (jbyteArray)jenv->CallObjectMethod(sql, gJNICache.getBytesMethodId))
                == NULL)
        {
            throwSQLException(jenv, INVALID_SQL_STRING_ERROR, NULL, "HY090");
            FUNCTION_RETURN_VOID(("getBytesMethod returned NULL"));
        }
        if ((nSql = (const char *)JNI_GetByteArrayElements(jenv,sqlByteArray, &isCopy)) == NULL)
        {
            throwSQLException(jenv, INVALID_SQL_STRING_ERROR, NULL, "HY090");
            FUNCTION_RETURN_VOID(("GetByteArrayElements returned NULL"));
        }
        len = JNI_GetArrayLength(jenv,sqlByteArray);
        sqlString.dataValue._buffer = (unsigned char *)nSql;
        sqlString.dataValue._length = len;
        DEBUG_OUT(DEBUG_LEVEL_CLI,("sqlString = '%s', length =%ld", nSql, len));
        MEMORY_DUMP(DEBUG_LEVEL_CLI, nSql, len);
    }
    else
    {
        throwSQLException(jenv, INVALID_SQL_STRING_ERROR, NULL, "HY090");
        FUNCTION_RETURN_VOID(("sql is NULL"));
    }

    if (stmtLabel)
        nStmtLabel = JNI_GetStringUTFChars(jenv,stmtLabel, NULL);
    else
    {
        throwSQLException(jenv, INVALID_STMT_LABEL_ERROR, NULL, "HY000");
        FUNCTION_RETURN_VOID(("stmtLabel is NULL"));
    }

    if (cursorName)
        nCursorName = JNI_GetStringUTFChars(jenv,cursorName, NULL);
    else
        nCursorName = NULL;

    if ((txn_status = beginTxnControl(jenv, currentTxid, externalTxid, txnMode, -1) != 0))
    {
        jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
        throwTransactionException(jenv, txn_status);
        FUNCTION_RETURN_VOID(("beginTxnControl() failed"));
    }

    exception_.u.SQLError.errorList._buffer = NULL;
    odbc_SQLSvc_ExecDirect_sme_(NULL, NULL,
                                &exception_,
                                dialogueId,
                                nStmtLabel,
                                (char *)nCursorName,
                                "",					// StmtExplainName
                                EXTERNAL_STMT,
                                (isSelect ? TYPE_SELECT : TYPE_UNKNOWN),
                                &sqlString,
                                holdability,
                                queryTimeout,
                                (long) resultSet,
                                &estimatedCost,
                                &outputDesc,
                                &rowsAffected,
                                &sqlWarning,
                                &stmtId,
                                currentStmtId);

    if (sql)
        JNI_ReleaseByteArrayElements(jenv,sqlByteArray, (jbyte *)nSql, JNI_ABORT);
    if (stmtLabel)
        JNI_ReleaseStringUTFChars(jenv,stmtLabel, nStmtLabel);
    if (cursorName)
        JNI_ReleaseStringUTFChars(jenv,cursorName, nCursorName);

    if ((txn_status = endTxnControl(jenv, currentTxid, txid, autoCommit,
                                    exception_.exception_nr, isSelect, txnMode, externalTxid)) != 0)
    {
        jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
        throwTransactionException(jenv, txn_status);
        FUNCTION_RETURN_VOID(("endTxnControl() Failed"));
    }

    switch (exception_.exception_nr)
    {
    case CEE_SUCCESS:
        if (sqlWarning._length != 0)
            setSQLWarning(jenv, jobj, &sqlWarning);
        setExecuteDirectOutputs(jenv, jobj, &outputDesc, rowsAffected, currentTxid, stmtId);
        break;
    case odbc_SQLSvc_ExecDirect_ParamError_exn_:
        jenv->CallVoidMethod(jobj, gJNICache.setCurrentStmtIdMethodId, stmtId);
        jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
        throwSQLException(jenv, PROGRAMMING_ERROR, exception_.u.ParamError.ParamDesc, "HY000");
        break;
    case odbc_SQLSvc_ExecDirect_SQLError_exn_:
        jenv->CallVoidMethod(jobj, gJNICache.setCurrentStmtIdMethodId, stmtId);
        jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
        throwSQLException(jenv, &exception_.u.SQLError);
        break;
    case odbc_SQLSvc_ExecDirect_SQLQueryCancelled_exn_:
        jenv->CallVoidMethod(jobj, gJNICache.setCurrentStmtIdMethodId, stmtId);
        jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
        throwSQLException(jenv, QUERY_CANCELLED_ERROR, NULL, "HY008",
                          exception_.u.SQLQueryCancelled.sqlcode);
        break;
    case odbc_SQLSvc_ExecDirect_SQLInvalidHandle_exn_:
        jenv->CallVoidMethod(jobj, gJNICache.setCurrentStmtIdMethodId, stmtId);
        jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
        throwSQLException(jenv, INVALID_HANDLE_ERROR, NULL, "HY000", exception_.u.SQLInvalidHandle.sqlcode);
        break;
    case odbc_SQLSvc_ExecDirect_SQLStillExecuting_exn_:
    case odbc_SQLSvc_ExecDirect_InvalidConnection_exn_:
    case odbc_SQLSvc_ExecDirect_TransactionError_exn_:
    default:
// TFDS - These error should not happen
        jenv->CallVoidMethod(jobj, gJNICache.setCurrentStmtIdMethodId, stmtId);
        jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
        throwSQLException(jenv, PROGRAMMING_ERROR, NULL, "HY000", exception_.exception_nr);
        break;
    }
    FUNCTION_RETURN_VOID((NULL));
}
JNIEXPORT void JNICALL Java_org_trafodion_jdbc_t2_SQLMXCallableStatement_prepareCall
(JNIEnv *jenv, jobject jobj, jstring server, jlong dialogueId,
 jint txid, jboolean autoCommit, jint txnMode, jstring stmtLabel, jstring sql,
 jint queryTimeout, jint holdability, jint fetchSize)
{
	FUNCTION_ENTRY("Java_org_trafodion_jdbc_t2_SQLMXCallableStatement_prepareCall",("... fetchSize=%ld",
		fetchSize));

	long					estimatedCost;
	long					inputParamOffset;
	ERROR_DESC_LIST_def			sqlWarning;
	SQLItemDescList_def			outputDesc;
	SQLItemDescList_def			inputDesc;
	jint						currentTxid = txid;
	jint						externalTxid = 0;
	jbyteArray					sqlByteArray;
	jboolean					isCopy;
	long						stmtId;
	jsize						len;
	SQLValue_def				sqlString;
	const char					*nSql = NULL;
	const char					*nStmtLabel = NULL;
	short						txn_status;

	ExceptionStruct exception_;
	CLEAR_EXCEPTION(exception_);

	sqlString.dataCharset = 0;
	sqlString.dataInd = 0;
	sqlString.dataType = SQLTYPECODE_VARCHAR;

	if (sql)
	{
		if ((sqlByteArray = (jbyteArray)jenv->CallObjectMethod(sql, gJNICache.getBytesMethodId))
			== NULL)
		{
			throwSQLException(jenv, INVALID_SQL_STRING_ERROR, NULL, "HY090");
			FUNCTION_RETURN_VOID(("CallObjectMethod() Failed"));
		}
		if ((nSql = (const char *)JNI_GetByteArrayElements(jenv,sqlByteArray, &isCopy)) == NULL)
		{
			throwSQLException(jenv, INVALID_SQL_STRING_ERROR, NULL, "HY090");
			FUNCTION_RETURN_VOID(("GetByteArrayElements() Failed"));
		}
		len = JNI_GetArrayLength(jenv,sqlByteArray);
		//Start Soln. No.: 10-091103-5969
		sqlString.dataValue._buffer = new unsigned char [len+1];
		memset(sqlString.dataValue._buffer,'\0',len+1);
		strncpy((char *)sqlString.dataValue._buffer,(const char *)nSql,len);
		//sqlString.dataValue._buffer = (unsigned char *)nSql;
		//End Soln. No.: 10-091103-5969
		sqlString.dataValue._length = len;
	}
	else
	{
		throwSQLException(jenv, INVALID_SQL_STRING_ERROR, NULL, "HY090");
		FUNCTION_RETURN_VOID(("SQL string is Null"));
	}

	if (stmtLabel)
		nStmtLabel = JNI_GetStringUTFChars(jenv,stmtLabel, NULL);
	else
	{
		throwSQLException(jenv, INVALID_STMT_LABEL_ERROR, NULL, "HY000");
		FUNCTION_RETURN_VOID(("stmtLabel is Null"));
	}

	if ((txn_status = beginTxnControl(jenv, currentTxid, externalTxid, txnMode, -1)) != 0)
	{
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwTransactionException(jenv, txn_status);
		FUNCTION_RETURN_VOID(("beginTxnControl() failed"));
	}

	odbc_SQLSvc_Prepare_sme_(NULL, NULL,
		&exception_,
		dialogueId,
		nStmtLabel,
		"",					// StmtExplainName
		EXTERNAL_STMT,
		&sqlString,
		holdability,
		TYPE_CALL,
		0,
		fetchSize,
		queryTimeout,
		&estimatedCost,
		&inputDesc,
		&outputDesc,
		&sqlWarning,
		&stmtId,
		&inputParamOffset,
		NULL, // MFC
		false);

	if (sql)
	{
		JNI_ReleaseByteArrayElements(jenv,sqlByteArray, (jbyte *)nSql, JNI_ABORT);
	}

	if (stmtLabel)
		JNI_ReleaseStringUTFChars(jenv,stmtLabel, nStmtLabel);

	if ((txn_status = endTxnControl(jenv, currentTxid, txid, autoCommit, CEE_SUCCESS, FALSE, txnMode, externalTxid)) != 0)
	{
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwTransactionException(jenv, txn_status);
		FUNCTION_RETURN_VOID(("endTxnControl() Failed"));
	}

	switch (exception_.exception_nr)
	{
	case CEE_SUCCESS:
		outputDesc._length = 0;
		outputDesc._buffer = 0;
		setPrepareOutputs(jenv, jobj, &inputDesc, &outputDesc, currentTxid, stmtId, inputParamOffset);
		if (sqlWarning._length > 0)
			setSQLWarning(jenv, jobj, &sqlWarning);
		break;
	case odbc_SQLSvc_Prepare_SQLQueryCancelled_exn_:
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, QUERY_CANCELLED_ERROR, NULL, "HY008",
			exception_.u.SQLQueryCancelled.sqlcode);
		break;
	case odbc_SQLSvc_Prepare_SQLError_exn_:
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, &exception_.u.SQLError);
		break;
	case odbc_SQLSvc_Prepare_ParamError_exn_:
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, PROGRAMMING_ERROR, exception_.u.ParamError.ParamDesc, "HY000");
		break;
	case odbc_SQLSvc_Prepare_SQLInvalidHandle_exn_:
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, INVALID_HANDLE_ERROR, NULL, "HY000", exception_.u.SQLInvalidHandle.sqlcode);
		break;
	case odbc_SQLSvc_Prepare_InvalidConnection_exn_:
	case odbc_SQLSvc_Prepare_SQLStillExecuting_exn_:
	case odbc_SQLSvc_Prepare_TransactionError_exn_:
	default:
		// TFDS - These exceptions should not happen
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, PROGRAMMING_ERROR, NULL, "HY000", exception_.exception_nr);
		break;
	}
	FUNCTION_RETURN_VOID((NULL));
}
Пример #3
0
/* RFE: Batch update improvements
 * executeBatch() now contains an additional argument: contBatchOnError
 */
JNIEXPORT void JNICALL Java_org_trafodion_jdbc_t2_SQLMXStatement_executeBatch
(JNIEnv *jenv, jobject jobj, jstring server, jlong dialogueId, jint txid, jboolean autoCommit, jint txnMode,
 jstring stmtLabel, jstring cursorName, jobjectArray sqlCommands, jboolean isSelect, jint queryTimeout, jboolean contBatchOnError, jlong currentStmtId)
{
    FUNCTION_ENTRY("Java_org_trafodion_jdbc_t2_SQLMXStatement_executeBatch",
                   ("... dialogueId=0x%08x, txid=%ld, autoCommit=%s, stmtLabel=%s, cursorName=%s,txnMode=%ld, isSelect=%s,contBatchOnError=%s ...",
                    dialogueId,
                    txid,
                    DebugBoolStr(autoCommit),
                    DebugJString(jenv,stmtLabel),
                    DebugJString(jenv,cursorName),
                    txnMode,
                    DebugBoolStr(isSelect),
                    DebugBoolStr(contBatchOnError)));

    ExceptionStruct				exception_;
    long						estimatedCost;
    long						rowsAffected;
    ERROR_DESC_LIST_def			sqlWarning;
    SQLItemDescList_def			outputDesc;
    jint						currentTxid = txid;
    jint						externalTxid = 0;
    jsize						noOfCommands;
    jstring						sql;
    jint						i;

    const char		*nSql;
    const char		*nStmtLabel;
    const char		*nCursorName = NULL;
    jbyteArray		sqlByteArray;
    jboolean		isCopy;
    long			stmtId;
    jsize			len;
    SQLValue_def	sqlString;
    short			txn_status;
    // RFE: Batch update improvements
    jthrowable		queuedException = NULL;
    jthrowable		exceptionHead = NULL;
    bool			isSuspended = false;

    exception_.exception_nr = CEE_SUCCESS;

    if (stmtLabel)
        nStmtLabel = JNI_GetStringUTFChars(jenv,stmtLabel, NULL);
    else
    {
        throwSQLException(jenv, INVALID_STMT_LABEL_ERROR, NULL, "HY000");
        FUNCTION_RETURN_VOID(("stmtLabel is NULL"));
    }

    if (cursorName) nCursorName = JNI_GetStringUTFChars(jenv,cursorName, NULL);

    if ((txn_status = beginTxnControl(jenv, currentTxid, externalTxid, txnMode, -1) != 0))
    {
        jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
        throwTransactionException(jenv, txn_status);
        FUNCTION_RETURN_VOID(("beginTxnControl() failed"));
    }

    sqlString.dataCharset = 0;
    sqlString.dataInd = 0;
    sqlString.dataType = SQLTYPECODE_VARCHAR;

    noOfCommands = JNI_GetArrayLength(jenv,sqlCommands);

    for (i = 0; i < noOfCommands ; i++)
    {
        /* RFE: Batch update improvements
         * Resume the transaction if it was earlier suspended, by checking the
         * variable isSuspended. This is reset to false after the transaction is resumed.
         */
        if(isSuspended)
        {
            if ((txn_status = beginTxnControl(jenv, currentTxid, externalTxid, txnMode, -1) != 0))
            {
                jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
                throwTransactionException(jenv, txn_status);
                FUNCTION_RETURN_VOID(("beginTxnControl() failed"));
            }
            isSuspended = false;
        }
        sql = (jstring) JNI_GetObjectArrayElement(jenv,sqlCommands, i);
        if (sql)
        {
            if ((sqlByteArray = (jbyteArray)jenv->CallObjectMethod(sql, gJNICache.getBytesMethodId))
                    == NULL)
            {
                throwSQLException(jenv, INVALID_SQL_STRING_ERROR, NULL, "HY090");
                FUNCTION_RETURN_VOID(("getBytesMethod() returned NULL"));
            }
            if ((nSql = (const char *)JNI_GetByteArrayElements(jenv,sqlByteArray, &isCopy)) == NULL)
            {
                throwSQLException(jenv, INVALID_SQL_STRING_ERROR, NULL, "HY090");
                FUNCTION_RETURN_VOID(("GetByteArrayElements() returned NULL"));
            }
            len = JNI_GetArrayLength(jenv,sqlByteArray);
            sqlString.dataValue._buffer = (unsigned char *)nSql;
            sqlString.dataValue._length = len;
        }
        else
        {
            throwSQLException(jenv, INVALID_SQL_STRING_ERROR, NULL, "HY090");
            FUNCTION_RETURN_VOID(("sql is NULL"));
        }

        odbc_SQLSvc_ExecDirect_sme_(NULL, NULL,
                                    &exception_,
                                    dialogueId,
                                    nStmtLabel,
                                    (char *)nCursorName,
                                    "",					// StmtExplainName
                                    EXTERNAL_STMT,
                                    (isSelect ? TYPE_SELECT : TYPE_UNKNOWN),
                                    &sqlString,
                                    CLOSE_CURSORS_AT_COMMIT,
                                    queryTimeout,
                                    NULL,
                                    &estimatedCost,
                                    &outputDesc,
                                    &rowsAffected,
                                    &sqlWarning,
                                    &stmtId
                                    ,currentStmtId);

        if (sql)
            JNI_ReleaseByteArrayElements(jenv,sqlByteArray, (jbyte *)nSql, JNI_ABORT);

        /* RFE: Batch update improvements
         * Perform pre-function exit processing only if contBatchOnError is not set to true
         */
        if (exception_.exception_nr != CEE_SUCCESS)
        {
            //RFE: Batch update improvements
            if(!contBatchOnError)
            {
                if (stmtLabel)
                    JNI_ReleaseStringUTFChars(jenv,stmtLabel, nStmtLabel);
                if (cursorName)
                    JNI_ReleaseStringUTFChars(jenv,cursorName, nCursorName);
            }

            // Commit the transaction so all good statements are processed.
            txn_status = endTxnControl(jenv, currentTxid, txid, autoCommit,
                                       CEE_SUCCESS, isSelect, txnMode, externalTxid);
            jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
            if (txn_status != 0)
            {
                throwTransactionException(jenv, txn_status);
                DEBUG_OUT(DEBUG_LEVEL_ENTRY|DEBUG_LEVEL_TXN,("endTxnControl() Failed after ExecDirect failure"));
            }
            //RFE: Batch update improvements
            if(contBatchOnError)
                isSuspended = true;

        }

        switch (exception_.exception_nr)
        {
        case CEE_SUCCESS:
            if (sqlWarning._length != 0)
                setSQLWarning(jenv, jobj, &sqlWarning);
            jenv->CallVoidMethod(jobj, gJNICache.execDirectBatchOutputsMethodId, i, rowsAffected,
                                 currentTxid);
            break;
        case odbc_SQLSvc_ExecDirect_ParamError_exn_:
            jenv->CallVoidMethod(jobj, gJNICache.setCurrentStmtIdMethodId, stmtId);
            throwSQLException(jenv, PROGRAMMING_ERROR, exception_.u.ParamError.ParamDesc, "HY000");
            break;
        case odbc_SQLSvc_ExecDirect_SQLError_exn_:
            jenv->CallVoidMethod(jobj, gJNICache.setCurrentStmtIdMethodId, stmtId);
            throwSQLException(jenv, &exception_.u.SQLError);
            break;
        case odbc_SQLSvc_ExecDirect_SQLQueryCancelled_exn_:
            jenv->CallVoidMethod(jobj, gJNICache.setCurrentStmtIdMethodId, stmtId);
            throwSQLException(jenv, QUERY_CANCELLED_ERROR, NULL, "HY008",
                              exception_.u.SQLQueryCancelled.sqlcode);
            break;
        case odbc_SQLSvc_ExecDirect_SQLInvalidHandle_exn_:
            jenv->CallVoidMethod(jobj, gJNICache.setCurrentStmtIdMethodId, stmtId);
            throwSQLException(jenv, INVALID_HANDLE_ERROR, NULL, "HY000", exception_.u.SQLInvalidHandle.sqlcode);
            break;
        case odbc_SQLSvc_ExecDirect_SQLStillExecuting_exn_:
        case odbc_SQLSvc_ExecDirect_InvalidConnection_exn_:
        case odbc_SQLSvc_ExecDirect_TransactionError_exn_:
        default:
            // TFDS - These error should not happen
            jenv->CallVoidMethod(jobj, gJNICache.setCurrentStmtIdMethodId, stmtId);
            throwSQLException(jenv, PROGRAMMING_ERROR, NULL, "HY000", exception_.exception_nr);
            break;
        }
        /* RFE: Batch update improvements
         * Return to caller on error and if contBatchOnError is not true.
         */
        if (exception_.exception_nr != CEE_SUCCESS && !contBatchOnError)
            FUNCTION_RETURN_VOID(("exception_.exception_nr(%ld) is not CEE_SUCCESS",exception_.exception_nr));

        /* RFE: Batch update improvements
         * Queue up the exceptions.
         */
        if(jenv->ExceptionOccurred())
        {
            queuedException = jenv->ExceptionOccurred();
            if(exceptionHead)
                jenv->CallVoidMethod(exceptionHead, gJNICache.setNextExceptionMethodId,
                                     queuedException);
            else
                exceptionHead = queuedException;
        }

    }//end of for

    if (stmtLabel)
        JNI_ReleaseStringUTFChars(jenv,stmtLabel, nStmtLabel);

    if (cursorName)
        JNI_ReleaseStringUTFChars(jenv,cursorName, nCursorName);

    /* RFE: Batch update improvements
     * If contBatchOnError is true, CEE_SUCCESS is always passed instead of
     * exception_.exception_nr, so that endTxnControl suspends the transaction.
     */
    txn_status = endTxnControl(jenv, currentTxid, txid, autoCommit,
                               (contBatchOnError ? CEE_SUCCESS:exception_.exception_nr), isSelect, txnMode, externalTxid);
    jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
    if (txn_status != 0)
    {
        throwTransactionException(jenv, txn_status);
        FUNCTION_RETURN_VOID(("endTxnControl() failed"));
    }
    /* RFE: Batch update improvements
     * Throw the queued exception if any */
    if(exceptionHead)
        jenv->Throw(exceptionHead);
    FUNCTION_RETURN_VOID((NULL));
}