logo       

Sponsor
FREE Network Mapping Tool for Microsoft® Office Visio® Professional 2007
Don't map your network by hand - let LANsurveyor Exx press for Microsoft Visio Professional 2007 automatically create network diagrams for you!

Re: MySQL ODBC Connector and iODBC woes.: msg#00041

db.mysql.odbc

Subject: Re: MySQL ODBC Connector and iODBC woes.

I have had no luck in getting the MySQL ODBC driver to work with the iODBC
driver manager.

I have removed unixODBC and any old drivers to avoid conflicts.

I'm using the most recent public releases (eg mysql-connector-odbc-3.51.12
and libiodbc-3.52.3).

I compiled the iODBC manager using the following configuration:

./configure --with-iodbc-inidir=/etc/iODBC/ --with-gtk-prefix=/opt/gnome/

iODBC Driver Manager 3.52.3 configuration summary
=================================================

Installation variables
layout default
prefix /usr/local
exec_prefix ${prefix}

Installation paths
programs ${exec_prefix}/bin
include files ${prefix}/include
libraries ${exec_prefix}/lib
manual pages ${prefix}/man

Configuration files
odbc.ini /etc/iODBC//odbc.ini
odbcinst.ini /etc/iODBC//odbcinst.ini

Extensions
ODBC Version 3
GUI Extensions true
ThreadSafe true
Install libodbc.so true


To get the MySQL driver to compile I made the following change:

--- driver/results.c.orig 2005-11-25 11:42:26.000000000 -0800
+++ driver/results.c 2005-11-25 11:42:45.000000000 -0800
@@ -558,7 +558,7 @@
SQLPOINTER CharacterAttributePtr,
SQLSMALLINT BufferLength,
SQLSMALLINT *StringLengthPtr,
- SQLPOINTER NumericAttributePtr )
+ SQLLEN * NumericAttributePtr )
#endif
{
return get_col_attr( StatementHandle,


I believe this is because the iODBC driver supports 3.52 calls where the
MySQL driver supports 3.51.

I configured the MySQL client as follows:

./configure --with-iODBC=/usr/local
--with-odbc-ini=/etc/iODBC/odbc.ini--with-debug --without-samples
--disable-test

Here's a portion of the configure output:

MySQL CONFIGURATION - CLIENT LIBS AND HEADERS
checking for mysql_real_query... yes
checking for mysql_real_query... (cached) yes
END OF MYSQL CONFIGURATION

ODBC DRIVER MANAGER CONFIGURATION - LIBRARIES AND HEADERS
checking for iodbc-config... /usr/local/bin/iodbc-config
checking for iodbc version... 3.52.3
checking isql.h usability... yes
checking isql.h presence... yes
checking for isql.h... yes
checking isqlext.h usability... yes
checking isqlext.h presence... yes
checking for isqlext.h... yes
checking isqltypes.h usability... yes
checking isqltypes.h presence... yes
checking for isqltypes.h... yes
checking iodbcinst.h usability... yes
checking iodbcinst.h presence... yes
checking for iodbcinst.h... yes
checking for _iodbcdm_admin_dialbox in -liodbcadm... yes
checking for SQLGetPrivateProfileString in -liodbcinst... yes
checking for SQLHENV... yes
checking for SQLHDBC... yes
checking for SQLHSTMT... yes
checking for SQLINTEGER... yes
checking for SQLUINTEGER... yes
checking for SQLSMALLINT... yes
checking for SQLUSMALLINT... yes
checking for SQLPOINTER... yes
checking for SQLHWND... yes
checking for SQLRETURN... yes
checking for SQLCHAR... yes
END OF DRIVER MANAGER CONFIGURATION

checking if debug mode is enabled... yes
checking if building of samples is enabled... no
checking if building of test is enabled... no
checking if linking of test library is specified... no

configure: creating ./config.status
config.status: creating Makefile
config.status: creating util/Makefile
config.status: creating driver/Makefile
config.status: creating driver_r/Makefile
config.status: creating setup/Makefile
config.status: creating MYODBCConfig/Makefile
config.status: creating myodbcinst/Makefile
config.status: creating imyodbc/Makefile
config.status: creating samples/Makefile
config.status: creating test/Makefile
config.status: creating scripts/Makefile
config.status: creating driver/myconf.h
config.status: executing depfiles commands

Success!!

I do not have any files in /etc/iODBC at the moment.
My ~/.odbc.ini file contains:

[ODBC Data Sources]
mysql = MySQL ODBC 3.51 Driver

[mysql]
Driver = /usr/local/lib/libmyodbc3.so
Description = MySQL Server
Server = localhost
Socket = /tmp/mysql.sock
Port =
User = pbday
Password =
Database =
Option = 20
Stmt =

[ODBC]
Trace = 1
TraceFile = /tmp/odbctrace.log
Debug = 1
DebugFile = /tmp/odbcdebug.log


My ~/.odbcinst.ini file contains:
[ODBC Drivers]
MySQL ODBC 3.51 Driver = Installed

[MySQL ODBC 3.51 Driver]
Driver = /usr/local/lib/libmyodbc3.so
Setup = /usr/local/lib/libmyodbc3S.so

Stracing the iodbctest program gives:

pbday@circe:~> strace -etrace=open iodbctest dsn=mysql
open("/etc/ld.so.cache", O_RDONLY) = 3
open("/lib/libdl.so.2", O_RDONLY) = 3
open("/lib/tls/libc.so.6", O_RDONLY) = 3
iODBC Demonstration program
This program shows an interactive SQL processor
open("/home/pbday/.odbc.ini", O_RDONLY) = 3
open("/home/pbday/.odbc.ini", O_RDONLY) = 3
open("/tmp/odbctrace.log", O_WRONLY|O_CREAT|O_TRUNC, 0644) = 3
open("/etc/localtime", O_RDONLY) = 4
open("/etc/localtime", O_RDONLY) = 4
Driver Manager: 03.52.0305.1107
open("/home/pbday/.odbc.ini", O_RDONLY) = 4
open("/home/pbday/.odbc.ini", O_RDONLY) = 4
open("/home/pbday/.odbc.ini", O_RDONLY) = 4
open("/home/pbday/.odbc.ini", O_RDONLY) = 4
open("/home/pbday/.odbc.ini", O_RDONLY) = 4
open("/usr/local/lib/libmyodbc3.so", O_RDONLY) = 4
open("/etc/ld.so.cache", O_RDONLY) = 4
open("/lib/libcrypt.so.1", O_RDONLY) = 4
open("/lib/libnsl.so.1", O_RDONLY) = 4
open("/lib/tls/libm.so.6", O_RDONLY) = 4
open("/lib/libnss_files.so.2", O_RDONLY) = 4
open("/lib/libnss_dns.so.2", O_RDONLY) = 4
open("/lib/libresolv.so.2", O_RDONLY) = 4
open("/usr/lib/libltdl.so.3", O_RDONLY) = 4
open("/lib/libz.so.1", O_RDONLY) = 4
open("/usr/local/lib/libiodbcadm.so.2", O_RDONLY) = 4
open("/usr/local/lib/libiodbcinst.so.2", O_RDONLY) = 4
open("/opt/gnome/lib/libgtk-1.2.so.0", O_RDONLY) = 4
open("/opt/gnome/lib/libgdk-1.2.so.0", O_RDONLY) = 4
open("/opt/gnome/lib/libgmodule-1.2.so.0", O_RDONLY) = 4
open("/opt/gnome/lib/libglib-1.2.so.0", O_RDONLY) = 4
open("/usr/X11R6/lib/libXi.so.6", O_RDONLY) = 4
open("/usr/X11R6/lib/libXext.so.6", O_RDONLY) = 4
open("/usr/X11R6/lib/libX11.so.6", O_RDONLY) = 4
open("/usr/local/lib/libiodbc.so.2", O_RDONLY) = 4
open("/etc/localtime", O_RDONLY) = 4
open("/etc/localtime", O_RDONLY) = 4

Have a nice day.


Note I never get a connection.
The ODBC driver manager gives the following trace:

~> cat /tmp/odbctrace.log
** iODBC Trace file
** Trace started on Fri Nov 25 16:13:00 2005
** Driver Manager: 03.52.0305.1107


[000000.001039]
iodbctest 00000000 ENTER SQLAllocHandle
SQLSMALLINT 1 (SQL_HANDLE_ENV)
SQLHANDLE 0x0 (SQL_NULL_HANDLE)
SQLHANDLE * 0x8082660

[000000.001215]
iodbctest 00000000 EXIT SQLAllocHandle with return code 0
(SQL_SUCCESS)
SQLSMALLINT 1 (SQL_HANDLE_ENV)
SQLHANDLE 0x0 (SQL_NULL_HANDLE)
SQLHANDLE * 0x8082660 (0x8084008)

[000000.001393]
iodbctest 00000000 ENTER SQLSetEnvAttr
SQLHENV 0x8084008
SQLINTEGER 200 (SQL_ATTR_ODBC_VERSION)
SQLPOINTER 0x3
SQLINTEGER * -5 (SQL_IS_UINTEGER)

[000000.001596]
iodbctest 00000000 EXIT SQLSetEnvAttr with return code 0
(SQL_SUCCESS)
SQLHENV 0x8084008
SQLINTEGER 200 (SQL_ATTR_ODBC_VERSION)
SQLPOINTER 0x3
SQLINTEGER * -5 (SQL_IS_UINTEGER)

[000000.001793]
iodbctest 00000000 ENTER SQLAllocHandle
SQLSMALLINT 2 (SQL_HANDLE_DBC)
SQLHANDLE 0x8084008
SQLHANDLE * 0x808265c

[000000.001968]
iodbctest 00000000 EXIT SQLAllocHandle with return code 0
(SQL_SUCCESS)
SQLSMALLINT 2 (SQL_HANDLE_DBC)
SQLHANDLE 0x8084008
SQLHANDLE * 0x808265c (0x8084328)

[000000.002144]
iodbctest 00000000 ENTER SQLSetConnectOption
SQLHDBC 0x8084328
SQLUSMALLINT 1051 (unknown connection attribute)
SQLLEN 134705901

[000000.002315]
iodbctest 00000000 EXIT SQLSetConnectOption with return code 0
(SQL_SUCCESS)
SQLHDBC 0x8084328
SQLUSMALLINT 1051 (unknown connection attribute)
SQLLEN 134705901

[000000.002490]
iodbctest 00000000 ENTER SQLGetInfo
SQLHDBC 0x8084328
SQLUSMALLINT 171 (SQL_DM_VER)
SQLPOINTER 0xbfa7d680
SQLSMALLINT 255
SQLSMALLINT * 0xbfa7d47e

[000000.002720]
iodbctest 00000000 EXIT SQLGetInfo with return code 0 (SQL_SUCCESS)
SQLHDBC 0x8084328
SQLUSMALLINT 171 (SQL_DM_VER)
SQLPOINTER 0xbfa7d680
| 03.52.0305.1107
|
SQLSMALLINT 255
SQLSMALLINT * 0xbfa7d47e (15)

[000000.003015]
iodbctest 00000000 ENTER SQLDriverConnect
SQLHDBC 0x8084328
SQLPOINTER 0x0
SQLCHAR * 0xbfa7d8b0
| dsn=mysql
|
SQLSMALLINT -3 (SQL_NTS)
SQLCHAR * 0x8082700
SQLSMALLINT 4096
SQLSMALLINT * 0xbfa7d47a
SQLUSMALLINT 1 (SQL_DRIVER_COMPLETE)

[000000.018887]
iodbctest 00000000 EXIT SQLDriverConnect with return code -2
(SQL_INVALID_HANDLE)
SQLHDBC 0x8084328
SQLPOINTER 0x0
SQLCHAR * 0xbfa7d8b0
SQLSMALLINT -3 (SQL_NTS)
SQLCHAR * 0x8082700
SQLSMALLINT 4096
SQLSMALLINT * 0xbfa7d47a
SQLUSMALLINT 1 (SQL_DRIVER_COMPLETE)

[000000.019245]
iodbctest 00000000 ENTER SQLGetDiagRec
SQLSMALLINT 2 (SQL_HANDLE_DBC)
SQLHDBC 0x8084328
SQLSMALLINT 1
SQLCHAR * 0xbfa7d230
SQLINTEGER * 0xbfa7d22c
SQLCHAR * 0xbfa7d240
SQLSMALLINT 512
SQLSMALLINT * 0x0

[000000.019559]
iodbctest 00000000 EXIT SQLGetDiagRec with return code -2
(SQL_INVALID_HANDLE)
SQLSMALLINT 2 (SQL_HANDLE_DBC)
SQLHDBC 0x8084328
SQLSMALLINT 1
SQLCHAR * 0xbfa7d230
SQLINTEGER * 0xbfa7d22c
SQLCHAR * 0xbfa7d240
SQLSMALLINT 512
SQLSMALLINT * 0x0

[000000.019858]
iodbctest 00000000 ENTER SQLGetDiagRec
SQLSMALLINT 1 (SQL_HANDLE_ENV)
SQLHENV 0x8084008
SQLSMALLINT 1
SQLCHAR * 0xbfa7d230
SQLINTEGER * 0xbfa7d22c
SQLCHAR * 0xbfa7d240
SQLSMALLINT 512
SQLSMALLINT * 0x0

[000000.020183]
iodbctest 00000000 EXIT SQLGetDiagRec with return code 100
(SQL_NO_DATA_FOUND)
SQLSMALLINT 1 (SQL_HANDLE_ENV)
SQLHENV 0x8084008
SQLSMALLINT 1
SQLCHAR * 0xbfa7d230
SQLINTEGER * 0xbfa7d22c
SQLCHAR * 0xbfa7d240
SQLSMALLINT 512
SQLSMALLINT * 0x0

[000000.020536]
iodbctest 00000000 ENTER SQLGetDiagRec
SQLSMALLINT 2 (SQL_HANDLE_DBC)
SQLHDBC 0x8084328
SQLSMALLINT 1
SQLCHAR * 0xbfa7daa0
SQLINTEGER * 0xbfa7da9c
SQLCHAR * 0xbfa7dab0
SQLSMALLINT 512
SQLSMALLINT * 0x0

[000000.020848]
iodbctest 00000000 EXIT SQLGetDiagRec with return code -2
(SQL_INVALID_HANDLE)
SQLSMALLINT 2 (SQL_HANDLE_DBC)
SQLHDBC 0x8084328
SQLSMALLINT 1
SQLCHAR * 0xbfa7daa0
SQLINTEGER * 0xbfa7da9c
SQLCHAR * 0xbfa7dab0
SQLSMALLINT 512
SQLSMALLINT * 0x0

[000000.021156]
iodbctest 00000000 ENTER SQLGetDiagRec
SQLSMALLINT 1 (SQL_HANDLE_ENV)
SQLHENV 0x8084008
SQLSMALLINT 1
SQLCHAR * 0xbfa7daa0
SQLINTEGER * 0xbfa7da9c
SQLCHAR * 0xbfa7dab0
SQLSMALLINT 512
SQLSMALLINT * 0x0

[000000.021462]
iodbctest 00000000 EXIT SQLGetDiagRec with return code 100
(SQL_NO_DATA_FOUND)
SQLSMALLINT 1 (SQL_HANDLE_ENV)
SQLHENV 0x8084008
SQLSMALLINT 1
SQLCHAR * 0xbfa7daa0
SQLINTEGER * 0xbfa7da9c
SQLCHAR * 0xbfa7dab0
SQLSMALLINT 512
SQLSMALLINT * 0x0

[000000.021773]
iodbctest 00000000 ENTER SQLFreeHandle
SQLSMALLINT 2 (SQL_HANDLE_DBC)
SQLHDBC 0x8084328

[000000.021933]
iodbctest 00000000 EXIT SQLFreeHandle with return code 0
(SQL_SUCCESS)
SQLSMALLINT 2 (SQL_HANDLE_DBC)
SQLHDBC 0x8084328

[000000.022084]
iodbctest 00000000 ENTER SQLFreeHandle
SQLSMALLINT 1 (SQL_HANDLE_ENV)
SQLHENV 0x8084008

[000000.022234]
iodbctest 00000000 EXIT SQLFreeHandle with return code 0
(SQL_SUCCESS)
SQLSMALLINT 1 (SQL_HANDLE_ENV)
SQLHENV 0x8084008

** Trace finished on Fri Nov 25 16:13:00 2005


The /tmp/myodbc.log has the following:
~> cat /tmp/myodbc.log
| start: Driver name: MySQL ODBC 3.51 Driver Version: 03.51.12
| start: TIMESTAMP: 051125 13:04:43
| >get_client_flag
| | info: option_flag: 4 client_flag: 131136
| <get_client_flag
| exit: SQL_ERROR
<SQLConnect
>SQLFreeConnect
| exit: SQL_SUCCESS
<SQLFreeConnect


Any ideas? Thanks for any help offered.

-Pat.

--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe: http://lists.mysql.com/myodbc?unsub=gcdmo-myodbc@xxxxxxxxxxx




<Prev in Thread] Current Thread [Next in Thread>
Sponsor
FREE Network Mapping Tool for Microsoft® OfficeVisio Professional 2007
Don't map your network by hand - let LANsurveyor Express for Microsoft Visio Professional 2007
automatically create network diagrams for you!
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | sitemap | advertise | OSDir is an inevitable website. super tiny logo