[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-odbc
Subject:    Caught in the Middle: ODBC 2.0 and 3.0 (SQLParamOptions and SQLSetStmtAttr)
From:       "Thomas Blomseth Christiansen" <thomas () thjbogbinderi ! dk>
Date:       2000-01-28 7:02:29
[Download RAW message or body]

Hi,

I am trying connect an application using MyODBC 2.50.29 on a WIN95 workstation with \
the MS MDAC 2.1.2.4202.3(DA) to our MySQL server (MySQL 3.22.22) running on WINNT4.0.

Obtaining the connection via ODBC is no problem; I've done that before with e.g. \
Access. The problem seems related to the version of ODBC supported by MyODBC.

My main question is: Has anybody compiled MyODBC with ODBC 3.0 support? Or compiled \
the current version of MyODBC with an internal version of 3.0 or higher in order to \
cheat the ODBC driver manager?

If so I should be very interested in the binary. I'd figure there would be no need of \
the installer as I could register it in the registry by hand. Likewise it does not \
matter if the MyODBC driver does not have the full functionality of a ODBC 3.0 driver \
as long as it has the functionality needed for this purpose.

For those interested in the full story:

After preparing a query (see excerpts of the logs below) the application calls the \
function SQLParamOptions and the ODBC driver manager stops the fun with the message \
"Driver does not support this function". I've checked the list of functions in the \
ADMNDEMO program and it says that SQLParamOptions is deprecated and not supported by \
MyODBC. 

There is, however, more to it than that. According to MS's ODBC documentation the \
SQLParamOptions (http://msdn.microsoft.com/library/psdk/dasdk/odch7y0j.htm) is \
deprecated  and replaced in ODBC 3.0 by the SQLSetStmtAttr \
(http://msdn.microsoft.com/library/psdk/dasdk/odch77jm.htm). When a ODBC 2.0 \
application calls an ODBC 3.0 driver with SQLParamOptions the ODBC 3.0 driver manager \
should map the call to SQLStmtAttr as described in  "Mapping Deprecated Functions"
(http://msdn.microsoft.com/library/psdk/dasdk/odap9rlf.htm).

The function list in the ADMNDEMO lists the SQLSetStmtAttr as supported by MyODBC so \
the function is provided, but it is not used. My thesis is that because the ODBC \
driver manager sees MyODBC as ODBC 2.0 driver it does not map the function. It \
expects a 2.0 driver like MyODBC to support the function and therefore does not \
invoke the mapping.

I have tried to cheat the driver manager by registrering MyODBC as a 3.0 driver, but \
it did not work. I guess it is not enough as the SQL_DRIVER_VER reports MyODBC as a \
version 2.50.29.

Any good suggestions will be much appreciated.

Thanks in advance,
Thomas

Excerpt from MYODBC.LOG:

> my_SQLPrepare
> > _mymalloc
> > enter: Size: 76
> > exit: ptr: 7c01238
> <_mymalloc
> enter: Query: SELECT Id,Ref,Timestamp,Version,Class,Method,Args FROM in_queue ORDER \
> BY Id
> exit: Parameter count: 0
<my_SQLPrepare
> SQLDisconnect
> > SQLFreeStmt

Excerpt from SQL.LOG created by the ODBC driver manager:

CAPS            ffcc7b01:ffcb9739 ENTER SQLPrepare 
  HSTMT               0x0717093c
  UCHAR *             0x00e10748 [      75] "SELECT \
Id,Ref,Timestamp,Version,Class,Method,Args FROM in_queue ORDER BY Id"  SDWORD         \
75

CAPS            ffcc7b01:ffcb9739 EXIT  SQLPrepare  with return code 0 (SQL_SUCCESS)
  HSTMT               0x0717093c
  UCHAR *             0x00e10748 [      75] "SELECT \
Id,Ref,Timestamp,Version,Class,Method,Args FROM in_queue ORDER BY Id"  SDWORD         \
75

CAPS            ffcc7b01:ffcb9739 ENTER SQLParamOptions 
  HSTMT               0x0717093c
  UDWORD                     1
  UDWORD *            0x0796ec10

CAPS            ffcc7b01:ffcb9739 EXIT  SQLParamOptions  with return code -1 \
(SQL_ERROR)  HSTMT               0x0717093c
  UDWORD                     1
  UDWORD *            0x0796ec10

  DIAG [IM001] [Microsoft][ODBC Driver Manager] Driver does not support this function \
(0) 

CAPS            ffcc7b01:ffcb9739 ENTER SQLErrorW 
  HENV                0x0726ff24
  HDBC                0x07170194
  HSTMT               0x0717093c
  WCHAR *             0x00b3edf8 (NYI) 
   SDWORD *            0x00b3ee30
  WCHAR *             0x00b3e9f8 
  SWORD                      512 
  SWORD *             0x00b3ee2e

CAPS            ffcc7b01:ffcb9739 EXIT  SQLErrorW  with return code 0 (SQL_SUCCESS)
  HENV                0x0726ff24
  HDBC                0x07170194
  HSTMT               0x0717093c
  WCHAR *             0x00b3edf8 (NYI) 
   SDWORD *            0x00b3ee30 (0)
  WCHAR *             0x00b3e9f8 [      70] "[Microsoft][ODBC Driver Manager] Dr"
  SWORD                      512 
  SWORD *             0x00b3ee2e (70)


---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail myodbc-thread1132@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail myodbc-unsubscribe@lists.mysql.com instead.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic