[unixODBC-dev] SQLConfigDataSource failing with sapdb driver

Nick Gorham nick.gorham at easysoft.com
Fri Aug 4 09:19:46 BST 2006


Ajit wrote:

>Hi,
> I am running 2.2.11 and am having a problem with SQLConfigDataSource
>failing.
>
>	SQLHENV   henv ;
>	SQLCHAR     SqlState[6],  Msg[SQL_MAX_MESSAGE_LENGTH];
>	SQLINTEGER    NativeError;
>	SQLSMALLINT   MsgLen;
>	SQLRETURN     rc2;
>
>	SQLAllocHandle (SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
>	SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
>	BOOL x = SQLConfigDataSource(0,ODBC_ADD_SYS_DSN,"SAP DB", AttributeString);
>	if (x !=TRUE)
>	{
>            DWORD temp;
>            WORD temp2;
>            rc2 =
>SQLInstallerError(1,&temp,(char*)Msg,SQL_MAX_MESSAGE_LENGTH,&temp2);
>		printf("Failed to create  System DSN %s",(char *) Msg);
>		SQLFreeHandle (SQL_HANDLE_ENV,  henv);
>		return -1;
>	}
>
>SQLinstallerError return the following
>Failed to create  System DSN General installer error
>
>  
>
The problem is that SQLConfigDataSource just tries to call the driver 
ConfigDSN so as you say will not do what you hope. Have a look at the 
code in exe/odbcinst.c to write create a data source.

-- 
Nick Gorham
Easysoft Limited
http://www.easysoft.com, http://www.unixODBC.org




More information about the unixODBC-dev mailing list