Topic
  • 1 reply
  • Latest Post - ‏2010-01-14T15:17:50Z by cscs010
cscs010
cscs010
17 Posts

Pinned topic unknown software exception (0xc000417) running Call Level Interface on Wi

‏2010-01-13T15:04:15Z |
I am trying to run the Call Level Interface example listed in the redbook: DB2 EXPRESS-C: The Developer Handbook for
XML, PHP, C/C++, JAVA and .NET.

the program compiles okay on Windows XP but abends as soon as I run it:
The exception unknown software exception (0xc000417) occurred in the application at location 0x00402ba3.

i cannot find anything about the above error 0xc000417.

this is what I used to compile and link:
db2 prep cliinv.sqc
cl -Zi -Od -c -W2 cliinv.c
link -debug -out:cliinv.exe cliinv.obj db2cli.lib db2api.lib c:\windsdk\lib\uuid.lib

this is the source code:
/******************************************************
  • Source File Name: CLIinventory.c
**
  • This simple CLI program will print a list of
  • products that need to be restocked.
  • The user needs to supply the minimum acceptable
  • quantity value before a product is considered to be
  • low in stock.
**
*******************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <sqlcli1.h>
int main(int argc, char *argv[]) {
SQLHANDLE env_handle;
SQLHANDLE conn_handle;
SQLHANDLE stmt_handle;
SQLCHAR PID11;
SQLINTEGER quantity;
SQLLEN ind[2];
SQLINTEGER min_quality=atoi(argv[1]);
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env_handle);
SQLAllocHandle(SQL_HANDLE_DBC, env_handle, &conn_handle);
SQLConnect(conn_handle, "sample", SQL_NTS, NULL, SQL_NTS, NULL,
SQL_NTS);
SQLAllocHandle(SQL_HANDLE_STMT, conn_handle, &stmt_handle);
SQLPrepare(stmt_handle, "select quantity,PID from inventory where quantity <? order by quantity", SQL_NTS);
SQLBindParameter(stmt_handle, 1, SQL_PARAM_INPUT, SQL_C_LONG,
SQL_INTEGER,0,0,&min_quality,0,NULL);
SQLExecute(stmt_handle);
SQLBindCol(stmt_handle, 1, SQL_C_LONG, &quantity, 0,&ind[0]);
SQLBindCol(stmt_handle, 2, SQL_C_CHAR, PID, sizeof(PID),&ind[1]);
printf("\nProducts to Restock (less than %d)\n",min_quality);
printf("-------------------------------------\n");
while (SQLFetch(stmt_handle)==SQL_SUCCESS)
printf("%d\t%s\n",quantity, PID);
SQLFreeHandle(SQL_HANDLE_STMT, stmt_handle);
SQLDisconnect(conn_handle);
SQLFreeHandle(SQL_HANDLE_DBC,conn_handle);
SQLFreeHandle(SQL_HANDLE_ENV,env_handle);
return SQL_SUCCESS;
}
Updated on 2010-01-14T15:17:50Z at 2010-01-14T15:17:50Z by cscs010
  • cscs010
    cscs010
    17 Posts

    Re: unknown software exception (0xc000417) running Call Level Interface on Wi

    ‏2010-01-14T15:17:50Z  
    i should have looked at the code more closely - it required a numeric to be entered as the first parm and did not check if one was
    present or not.