Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> statment handle pointer is null

statment handle pointer is null

From: <bspears_at_computer.org>
Date: Wed, 08 Jul 1998 18:01:34 GMT
Message-ID: <6o0c5v$jl5$1@nnrp1.dejanews.com>


Using MS ODBC driver 2.5 for Oracle, MTS 2.0, and DCOM, I have run into a problem.

I am allocating and releasing statement handles for various tasks (a code snippet follows). The problem is that sometimes my SQLAllocHandle statement fails. The Mystery is that it is not always the same on. Each of them has worked at one time or another, but many of them have failed. Sometimes it will fail on the first try after connecting to the database, other times, I can run the application for a couple of hours before my SQLAllocHandle fails to return a pointer. No code is being changed; we just shut down the process, run it again, and it's fine again... for a while. The thing seems to be that everything works for a short while. I'm thinking that I'm running out of some kind of resource, but I can't figure out which. The following code structure is identical in all methods. This particular one was chosen to be included because the last time the hstmt1 value was null (see below), this was the most recent successful method. In other words, the one right after this one failed using the exact same code as you see here to allocate a statment handle.

thanks for any help,
Bobby Spears

------------->>Code<<--------------

	SQLRETURN  retcode;
	SQLINTEGER  lpctypeLen = SQL_NTS, retLen= SQL_NTS, len = 0;
	SQLCHAR* sIssuer = NULL;
    SQLCHAR* sReceiver = NULL;
	SQLCHAR* sAppro = NULL;
    SQLCHAR* sFy = NULL;
	SQLCHAR* sDocDate = NULL;
	SQLCHAR* sAuthBy = NULL;
    long docIndex=0;
	int countArgs;
	countArgs = 9; // number of parameter in store procedure including
in/out param

        SQLHSTMT hstmt1 = NULL;
    // need to change the store procedure name here     m_dbUtility.mCallStoreProcName1("frms_auth_api.insert_auth",countArgs );

        m_msg.RecordMessage("We are in Authorize.PutHeader()");

        retcode = SQLAllocHandle(SQL_HANDLE_STMT, m_dbUtility.m_hdbc, &hstmt1);

	if (hstmt1 == NULL)
	{
		m_msg.RecordMessage("Unable to get a Statement handle");
		m_msg.DeliverMessage("Unable to get a Statement handle",
IID_IAuthorize);
		return E_FAIL;
	}

    sAppro = m_dbUtility.SQLCHARFromBSTR(appro);

/** BINDINGS **/
...

	retcode =	SQLExecDirect(hstmt1,m_dbUtility.stmtText1, SQL_NTS);
	m_dbUtility.mODBCExecDirectError(retcode,hstmt1);
	*rval    = A2BSTR((char*)m_dbUtility.ret);
    *DocId = docIndex;
cleanbuffer:
	{
		if(sIssuer!=NULL)
			delete sIssuer;
		if(sReceiver!=NULL)
			delete sReceiver;
		if(sAppro!=NULL)
			delete sAppro;
		if(sFy!=NULL)
			delete sFy;
		if(sDocDate!=NULL)
			delete sDocDate;
		if(sAuthBy!=NULL)
			delete sAuthBy;

		retStatus = m_dbUtility.setRetStatus(retcode);
		if (hstmt1 !=NULL)
			m_dbUtility.freeStmtHandle(hstmt1);
	}
	return (retStatus);

}

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Wed Jul 08 1998 - 13:01:34 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US