Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQLBindParameter followed by SQLExecDirect is returning -1 in 64bit OS. Nee

767563May 7 2010 — edited May 9 2010
Dear All,
I am porting my application from Windows 2003 Server 32bit to Windows 2008 Server R2(64bit).I am facing below issue.
When I run the SQLExecDirect() function it returns me -1 with the following error code "(1100 0BB4): Encountered ODBC error -1: S1000, 1400, [Oracle][ODBC][Ora]ORA-01400: cannot insert NULL into ("SPIRAL"."BLACKBOXES"."TABLENAME")"

Below I have given the code snippets.It does 7 SQLBindPrameter and then it calls the SQLExecDirect which in turn returns -1.
The same code base work perfectly with 32bit.




sprintf(sqlCommand, "insert into %s (bbid, tableName, keyType, keyCollectorFormat, firstCount, lastCount, elementSize) "
"values (?, ?, ?, ?, ?, ?, ?)", kBlackBoxesTable);



SQLLEN lsqlIdLengths = *(this->idLengths);
SQLBindParameter(lStatement,1, SQL_PARAM_INPUT, SQL_C_ULONG, SQL_INTEGER, 0, 0, this->blackBoxIDs, 0, &lsqlIdLengths);

//Here blackBoxIDs is unsigned long *.




SQLLEN lsqlkeyNameLengths = *(this->keyNameLengths);

SQLBindParameter(lStatement,2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR,
kSQLServerTableMaxNameLength, 0, this->keyNames, kSQLServerTableMaxNameLength, &lsqlkeyNameLengths);

//Here keynames is char *



SQLLEN lsqlkeyTypeLengths = *(this->keyTypeLengths);

SQLBindParameter(lStatement,3, SQL_PARAM_INPUT, SQL_C_ULONG, SQL_INTEGER,
0, 0, this->keyTypes, 0, &lsqlkeyTypeLengths);

// keyTypes is unsigned long *



SQLLEN lsqlkeyCollectorFormatLengths = *(this->keyCollectorFormatLengths);
SQLBindParameter(lStatement,4, SQL_PARAM_INPUT, SQL_C_ULONG, SQL_INTEGER,
0, 0, this->keyCollectorFormats, 0, &lsqlkeyCollectorFormatLengths);

// keyCollectorFormats is unsigned long *



SQLLEN lsqlfirstCountLengths = *(this->firstCountLengths);

SQLBindParameter(lStatement,5, SQL_PARAM_INPUT, SQL_C_ULONG, SQL_INTEGER,
0, 0, this->firstCounts, 0, &lsqlfirstCountLengths);

// firstCounts is of SDWORD*;



SQLLEN lsqllastCountLengths = *(this->lastCountLengths);

SQLBindParameter(lStatement,6, SQL_PARAM_INPUT, SQL_C_ULONG, SQL_INTEGER,
0, 0, this->lastCounts, 0, &lsqllastCountLengths);

//lastCounts is of SDWORD*;



SQLLEN lsqlelementSizeLengths = *(this->elementSizeLengths);

SQLBindParameter(lStatement,7, SQL_PARAM_INPUT, SQL_C_ULONG, SQL_INTEGER,
0, 0, this->elementSizes, 0, &lsqlelementSizeLengths);

//elementSizes is of SDWORD*;


Where typdef long int SDWORD


RETCODE result = SQLExecDirect(lStatement, (unsigned char*) query, SQL_NTS);

//This gives me result = -1;

And the following error

(1100 0BB4): Encountered ODBC error -1: S1000, 1400, [Oracle][ODBC][Ora]ORA-01400: cannot insert NULL into ("SPIRAL"."BLACKBOXES"."TABLENAME")


Thanks in advance.
-R
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 6 2010
Added on May 7 2010
4 comments
1,088 views