Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Connecting to an advantage database server
Message
From
03/08/2003 05:10:28
 
 
To
01/08/2003 04:20:34
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00815298
Message ID:
00816277
Views:
15
>the problem with the solution suggested by aleksey is that i downloaded the latest driver from extended systems only yesterday before starting any of this!
>anyone have a previous advantage odbc driver that works?

Hi Barry,

You can try to ask Extended Systems to fix the issue.
Here is the code in C++ the demonstrates the issue:
#include <windows.h>
#include <stdio.h>

#define ODBCVER	0x0210
#include <sql.h>
#include <sqlext.h>


void ODBCError(SQLHENV hEnv)
{
	SDWORD nativeError=0;
	SQLCHAR szSqlState[100];
	SQLCHAR szOdbcMsg[2048 + 1];
	SWORD cbOdbcMsg=0;
	RETCODE retcode;
	
	while ((retcode = SQLError(hEnv,NULL,NULL,szSqlState,&nativeError, szOdbcMsg, 2048, &cbOdbcMsg))==SQL_SUCCESS || 
		retcode == SQL_SUCCESS_WITH_INFO)
	{
		szOdbcMsg[cbOdbcMsg]='\0';
		printf("%s,%d, %s\n",szSqlState,(int)nativeError,szOdbcMsg);
	}
}

DWORD  HandleException(DWORD exceptioncode) 
{
	printf("\tException is thrown:0x%08X <---------------!!!\n",(int)exceptioncode);
	return EXCEPTION_EXECUTE_HANDLER;
}

void main(void)
{
	SQLHENV hEnv=NULL;
	SQLHDBC hDbc=NULL;
	SQLHSTMT hStmt=NULL;
	RETCODE retval=SQL_SUCCESS;
	BOOL fConnected=FALSE;
	SQLSMALLINT nOutLen=0;
	SQLCHAR sConnectString[1024];

	retval=SQLAllocEnv(&hEnv);
	if(!SUCCEEDED(retval) || !hEnv)
	{
		printf("SQLAllocEnv failed.\n");
		goto exitproc;
	}

	retval=SQLAllocConnect(hEnv,&hDbc);
	if(!SUCCEEDED(retval) || !hDbc)
	{
		ODBCError(hEnv);
		printf("SQLAllocConnect failed.\n");
		goto exitproc;
	}

	printf("Trying to connect ...\n");
	retval=SQLDriverConnect(hDbc,GetDesktopWindow(),(SQLCHAR*)"",SQL_NTS,sConnectString,sizeof(sConnectString),&nOutLen,SQL_DRIVER_PROMPT);
	if(!SUCCEEDED(retval))
	{
		ODBCError(hEnv);
		printf("SQLDriverConnect failed.\n");
		goto exitproc;
	}
	else
	{
		sConnectString[nOutLen]='\0';
		printf("Connected: %s\n",sConnectString);
	}

	retval=SQLAllocStmt(hDbc,&hStmt);
	if(!SUCCEEDED(retval) || !hStmt)
	{
		ODBCError(hEnv);
		printf("SQLAllocStmt failed.\n");
		goto exitproc;
	}

	printf("Trying to execute SQLExecDirect(hStmt,\"\",SQL_NTS).\n");
	__try
	{
		retval=SQLExecDirect(hStmt,(SQLCHAR*)"",SQL_NTS);
	}__except(HandleException(GetExceptionCode()))
	{
		;
	}
	
	printf("Trying to execute SQLExecDirect(hStmt,\"\",0).\n");
	__try
	{
		retval=SQLExecDirect(hStmt,(SQLCHAR*)"",0);
	}__except(HandleException(GetExceptionCode()))
	{
		;
	}

	printf("Trying to execute SQLExecDirect(hStmt,\"SELECT * FROM tets\",SQL_NTS).\n");
	__try
	{
		retval=SQLExecDirect(hStmt,(SQLCHAR*)"SELECT * FROM tets",SQL_NTS);
	}__except(HandleException(GetExceptionCode()))
	{
		;
	}
	
	printf("Trying to execute SQLExecDirect(hStmt,\"SELECT * FROM tets\",18).\n");
	__try
	{
		retval=SQLExecDirect(hStmt,(SQLCHAR*)"SELECT * FROM tets",18);
	}__except(HandleException(GetExceptionCode()))
	{
		;
	}

	printf("Trying to execute SQLExecDirect(hStmt,\"     \",SQL_NTS).\n");
	__try
	{
		retval=SQLExecDirect(hStmt,(SQLCHAR*)"     ",SQL_NTS);
	}__except(HandleException(GetExceptionCode()))
	{
		;
	}
	
	printf("Trying to execute SQLExecDirect(hStmt,\"     \",5).\n");
	__try
	{
		retval=SQLExecDirect(hStmt,(SQLCHAR*)"     ",5);
	}__except(HandleException(GetExceptionCode()))
	{
		;
	}
exitproc:

	if(hStmt)
		SQLFreeStmt(hStmt,SQL_DROP);

	if(hDbc)
	{
		if(fConnected)
		{
			SQLDisconnect(hDbc);
		}

		SQLFreeConnect(hDbc);
	}

	if(hEnv)
		SQLFreeEnv(hEnv);

	printf("Done, press any key to exit.");
	getchar();
}
Here is the output for Advantage StreamlineSQL ODBC 3.00.00.06 Extended Systems, Inc:
Trying to connect ...
Connected: DSN=....
Trying to execute SQLExecDirect(hStmt,"",SQL_NTS).
        Exception is thrown:0xC0000005 <---------------!!!
Trying to execute SQLExecDirect(hStmt,"",0).
Trying to execute SQLExecDirect(hStmt,"SELECT * FROM tets",SQL_NTS).
Trying to execute SQLExecDirect(hStmt,"SELECT * FROM tets",18).
Trying to execute SQLExecDirect(hStmt,"     ",SQL_NTS).
        Exception is thrown:0xC0000005 <---------------!!!
Trying to execute SQLExecDirect(hStmt,"     ",5).
        Exception is thrown:0xC0000005 <---------------!!!
Done, press any key to exit.
Thanks,
Aleksey.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform