[unixODBC-support] Does unixODBC on Mac OS X works?

Eric Sharkey sharkey at netrics.com
Thu Apr 7 16:56:02 BST 2005


> This is interesting.
> Do you think that I have to change the source code in the application?

Probably not.  It should be ok for an app to request either ODBC3 or
ODBC2.  In my case, it failed because I'd incorrectly built the driver.


> int open_connection ()
> {
>      SQLRETURN   ret; 
> 
>      /* Allocate Environment handle and register version */
>      ret = SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE, &ODenvi);
>      if (( ret != SQL_SUCCESS) && ( ret != SQL_SUCCESS_WITH_INFO))
>      {
> 	report_error("SQLAllocHandle()");
> 	return DB_FAILED;
>      } 
> 
>      ret = SQLSetEnvAttr(ODenvi, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
>      if ((ret != SQL_SUCCESS) && ( ret != SQL_SUCCESS_WITH_INFO))
>      { 
>     	report_error("SQLSetEnvAttr()");
> 	SQLFreeHandle(SQL_HANDLE_ENV, ODenvi);
> 	return DB_FAILED;
>      } 
> 
>      /* Allocate connection handle */
>      ret = SQLAllocHandle(SQL_HANDLE_DBC, ODenvi, &ODconn);
>      if (( ret != SQL_SUCCESS) && ( ret != SQL_SUCCESS_WITH_INFO))
>      {
> 	report_error("SQLAllocHandle()");
> 	SQLFreeHandle(SQL_HANDLE_ENV, ODenvi);
> 	return DB_FAILED;
>      } 
> 
>      /* Set timeout */
>      SQLSetConnectAttr( ODconn, SQL_LOGIN_TIMEOUT, (SQLPOINTER *)5, 0);
> 
>      return DB_OK;
> }

Is that it?  Where does it call SQLConnect/SQLDriverConnect/SQLBrowseConnect?

Eric



More information about the unixODBC-support mailing list