[unixODBC-support] RE : RE : RE : RE : ODBCConfig not loading setuplibrary

Ludo Brands ludo.brands at free.fr
Fri Apr 9 09:56:57 BST 2010


The fact that ODBCConfig interpretes SQLConfigDataSource returning false as
ConfigDSN not implemented in the driver (functions add_dsn and edit_dsn in
callbacks.c) had put me on the wrong foot. This interpretation is not
correct since SQLConfigDataSource returns false if ConfigDSN not implemented
or ConfigDSN returning false (my case) or other error cases. ConfigDSN
returning false is valid according to MS specs if combined with a call to
SQLPostInstallerError. 

May I suggest replacing in add_dsn and edit_dsn the following lines
<<<<
		if ( SQLConfigDataSource(( HWND ) 1, mode,
                driver_name, constr ))
		{
		}
 	
		else
>>>>
By something like this
<<<<
		BOOL bConfigDSNOK = ( SQLConfigDataSource(( HWND ) 1, mode,
            	    ptr, "" ))
		if (!bConfigDSNOK) //ConfigDSN could have reported error
		{	
			DWORD nErrorCode;	
			char szErrorMsg[FILENAME_MAX + 1];
			if
(SQLInstallerError(1,&nErrorCode,szErrorMsg,FILENAME_MAX,NULL)==SQL_SUCCESS)

	
bConfigDSNOK=(nErrorCode!=ODBC_ERROR_GENERAL_ERR);
			if (bConfigDSNOK) //ConfigDSN did report an error
			{
				char txt[ 1024 ];
				sprintf( txt, _("Driver returned with error
code %d : %s"),
nErrorCode,szErrorMsg );
  				message_box( txt, GNOME_MESSAGE_BOX_ERROR );

			}
		if (!bConfigDSNOK) //Setup library not found or ConfigDSN
not implemented 
>>>>

This modification is based on the following:
- SQLConfigDataSource pushes an error message for all cases except ConfigDSN
found. 
- SQLConfigDataSource pushes only ODBC_ERROR_GENERAL_ERR errors while
ConfigDSN cannot report these according to MS spec. SQLConfigDataSource can
also post a ODBC_ERROR_INVALID_REQUEST_TYPE but we can assume that
ODBCConfig has covered that one ;)
- logging is enabled. This should be the case looking at _logging.c


In version 2.2.14-p2 I also noticed that SQLInstallerError codes end with
ODBC_ERROR_OUTPUT_STRING_TRUNCATED (=22) while ConfigDSN can post
ODBC_ERROR_DRIVER_SPECIFIC (=23). Suggestion 2:
odbcinst.h add after line 144
<<<<
#define ODBC_ERROR_DRIVER_SPECIFIC 23
>>>>
SQLPostInstallerError.c line 24 should then become
<<<< 
	if (nErrorCode > ODBC_ERROR_DRIVER_SPECIFIC)   
>>>>
And in SQLInstallerError.c add after line 56
<<<<
	,ODBC_ERROR_DRIVER_SPECIFIC, "Driver- or translator-specific error"
>>>>

Thanks,
Ludo

-----Message d'origine-----
De : unixodbc-support-bounces at mailman.unixodbc.org
[mailto:unixodbc-support-bounces at mailman.unixodbc.org] De la part de Peter
Harvey
Envoyé : vendredi 9 avril 2010 03:12
À : unixodbc-support at mailman.unixodbc.org
Objet : Re: [unixODBC-support] RE : RE : RE : ODBCConfig not loading
setuplibrary


Just read the thread (been away). Glad to hear this was resolved - would
have 
hurt my head figuring it out :P

--
Peter


On Wednesday 07 April 2010 02:27:12 pm Nick Gorham wrote:
> Ludo Brands wrote:
> > So, nothing wrong with odbcinst and unixodbc. Sorry for the false 
> > alarm. Debugging libraries should be easier. Thanks a lot for the 
> > help.
> 
> Cool, thanks for letting us know.
> 
_______________________________________________
unixODBC-support mailing list unixODBC-support at mailman.unixodbc.org
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support



More information about the unixODBC-support mailing list