Bug #59900 Verion 5.1 exports symbols SQLInstallDriverEx and SQLInstallDriverExW
Submitted: 2 Feb 2011 18:50 Modified: 12 Oct 2012 19:21
Reporter: Alona Rossen Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:5.1.8 OS:Linux
Assigned to: Bogdan Degtyariov CPU Architecture:Any

[2 Feb 2011 18:50] Alona Rossen
Description:
Verion 5.1.8 exports symbols SQLInstallDriverEx and SQLInstallDriverExW. 
This makes MySQL Connector/ODBC incompatible with some commersial odbc packages, for example DataDirect ODBC and makes MyODBC dependent on unixODBC libodbcinst.so.1

This was not the case in version 5.1.5:

-sh-3.2$ nm mysql-connector-odbc-5.1.5-linux-x86-64bit/lib/libmyodbc5.so | grep SQLInstallDriverEx

-sh-3.2$ nm mysql-connector-odbc-5.1.8-linux-rhel5-x86-64bit/lib/libmyodbc5.so | grep SQLInstallDriverEx
                 U SQLInstallDriverEx
000000000007e422 T SQLInstallDriverExW

This is an attempt to load libmyodbc5-5.1.8.so with DataDirect libodbcinst.so on Linux:
/home/sambuild/odbc64> bin/ddtestlib /DB/MYSQL/V518/lib/libmyodbc5-5.1.8.so
Load of /DB/MYSQL/V518/lib/libmyodbc5-5.1.8.so failed: /DB/MYSQL/V518/lib/libmyodbc5-5.1.8.so: undefined symbol: SQLInstallDriverEx

The problemn is specific to Linux and si not reproducible on Solaris SPARC:

/home/sambuild/odbc64/lib> ldd /DB/MYSQL/V518_64/lib/libmyodbc5-5.1.8.so
        librt.so.1 =>    /lib/64/librt.so.1
        libresolv.so.2 =>        /lib/64/libresolv.so.2
        libsocket.so.1 =>        /lib/64/libsocket.so.1
        libnsl.so.1 =>   /lib/64/libnsl.so.1
        libm.so.2 =>     /lib/64/libm.so.2
        libpthread.so.1 =>       /lib/64/libpthread.so.1
        libodbcinst.so.1 =>      /home/sambuild/odbc64/lib/libodbcinst.so.1
        libdl.so.1 =>    /lib/64/libdl.so.1
        libthread.so.1 =>        /lib/64/libthread.so.1
        libc.so.1 =>     /lib/64/libc.so.1
        libaio.so.1 =>   /lib/64/libaio.so.1
        libmd.so.1 =>    /lib/64/libmd.so.1
        libmp.so.2 =>    /lib/64/libmp.so.2
        libscf.so.1 =>   /lib/64/libscf.so.1
        libHDicu25.so =>         /home/sambuild/odbc64/lib/libHDicu25.so
        libCrun.so.1 =>  /usr/lib/sparcv9/libCrun.so.1
        libdoor.so.1 =>  /lib/64/libdoor.so.1
        libuutil.so.1 =>         /lib/64/libuutil.so.1
        libgen.so.1 =>   /lib/64/libgen.so.1
        libm.so.1 =>     /usr/lib/sparcv9/libm.so.1
        /platform/SUNW,Sun-Fire-T1000/lib/sparcv9/libc_psr.so.1
        /platform/SUNW,Sun-Fire-T1000/lib/sparcv9/libmd_psr.so.1
/home/sambuild/odbc64/lib> ../bin/ddtestlib /DB/MYSQL/V518_64/lib/libmyodbc5-5.1.8.so
Load of /DB/MYSQL/V518_64/lib/libmyodbc5-5.1.8.so successful, qehandle is 0x7F001D68
File version: 06.10.0042 (U0029)
/home/sambuild/odbc64/lib>

How to repeat:
-sh-3.2$ nm mysql-connector-odbc-5.1.5-linux-x86-64bit/lib/libmyodbc5.so | grep SQLInstallDriverEx

-sh-3.2$ nm mysql-connector-odbc-5.1.8-linux-rhel5-x86-64bit/lib/libmyodbc5.so | grep SQLInstallDriverEx
                 U SQLInstallDriverEx
000000000007e422 T SQLInstallDriverExW
[4 Feb 2011 12:23] Bogdan Degtyariov
Alona,

Thank you for your bug report.
Setting it to verified.

We need to check HAVE_SQLGETPRIVATEPROFILESTRINGW preprocessor def, which affects exporting SQLInstallDriverExW function
[8 Mar 2012 8:46] Bogdan Degtyariov
bug fix

Attachment: bug59900.diff (application/octet-stream, text), 5.83 KiB.

[8 Mar 2012 9:15] Bogdan Degtyariov
nm libmyodbc5.so | grep SQLInstallDriverEx
displays the empty string now.
[12 Sep 2012 22:48] Ram Bysani
Hello

This is a very high priority for us. Could you please increase priority, and let us know in what version you plan to fix it?

Regards
Ram Bysani
rbysani@informatica.com
[12 Sep 2012 23:02] Ram Bysani
Please note that this issue is seen on all operating systems and not just Linux 64 bit.
[25 Sep 2012 13:05] Bogdan Degtyariov
patch v2

Attachment: bug59900v2.diff (application/octet-stream, text), 9.18 KiB.

[25 Sep 2012 13:24] Bogdan Degtyariov
SQLRemoveDriverW seems to be the matching pair for SQLInstallDriverExW and therefore must be removed too.
[25 Sep 2012 13:27] Bogdan Degtyariov
patch v3

Attachment: bug59900v3.diff (application/octet-stream, text), 10.09 KiB.

[25 Sep 2012 17:17] Lawrenty Novitsky
I approve v3 of the patch, but please remove windows line endings.
And do you need
+#ifdef HAVE_LPCWSTR
+# define MyODBC_LPCWSTR LPCWSTR
+#else
+# define MyODBC_LPCWSTR LPWSTR
+#endif

in the header file? Cuz in my opinion it is not really needed outside odbcinstw.c
[26 Sep 2012 7:30] Bogdan Degtyariov
I intended to remove #ifdef HAVE_LPCWSTR from odbcinstw.c because SQLInstallDriverExW/SQLRemoveDriverW have been removed from there as well.

Making LPCWSTR declarations available in stringutil.h looked better to me, but I am not against putting it into myodbc3i.c where the only usage of LPCWSTR declarations is.
[26 Sep 2012 9:35] Hemant Dangi
Agreed with patch and #ifdef HAVE_LPCWSTR can be moved to myodbc3i.c
[26 Sep 2012 11:00] Bogdan Degtyariov
Pushed to 5.1.12 (revision 1069)
[12 Oct 2012 19:21] John Russell
Added to changelog for 5.1.12: 

The symbols SQLInstallDriverEx, SQLInstallDriverExW, and
SQLRemoveDriverW were exported, causing incompatibility with some
commercial ODBC packages such as DataDirect ODBC, and making
Connector/ODBC dependent on the unixODBC library libodbcinst.so.1.
This issue was first observed in Connector/ODBC 5.1.8.