Bug #69108 SQLSetPos fails to update a row
Submitted: 30 Apr 2013 19:54 Modified: 1 May 2013 10:11
Reporter: Viorel Preoteasa Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:mysql-5.6.11,mysql-connector-odbc-5.2.4 OS:Linux (Ubuntu 12.04)
Assigned to: Bogdan Degtyariov CPU Architecture:Any
Tags: init_dynamic_string, SQLSetPos

[30 Apr 2013 19:54] Viorel Preoteasa
Description:
When I try to update a row in a table I get the error

libmyodbc5w.so: undefined symbol: init_dynamic_string

when calling SQLSetPos

I get the same error using the pre-compiled binaries
from Ubuntu repository, as well as using a fresh compilation
of the latest versions of unixODBC, mysql server, mysql
odbc connector.

It seems that mysql defines the function init_dynamic_string,
and I tried to link my application to libmysqlclient.a, and
other mysql libraries, but it did not help.

How to repeat:
The test application uses an adaptation of
CRecordset MFC class and dependencies compiled 
for Linux. I use the dynamic cursor.

If needed I can provide the test application, but it is 
rather large due to the fact that it contains all classes
needed for CRecordset.
[30 Apr 2013 19:56] Viorel Preoteasa
The trace of the odbc calls, ending with SQLSetPos which fails.

Attachment: odbc-trace.txt (text/plain), 9.76 KiB.

[1 May 2013 4:07] Bogdan Degtyariov
Can you please send the output from

ldd libmyodbc5w.so

I suspect the list of dependencies will contain libmysqlclient.so.
If it does, the OS-distributed driver is not built correctly. All MySQL ODBC drivers binaries distributed by Oracle are linked statically against libmysqlclient.a and all needed functions bodies are embedded into the driver's binary. This is done to avoid missing functions/libraries errors.
[1 May 2013 8:51] Viorel Preoteasa
The output of ldd libmyodbc5w.so is:

	linux-vdso.so.1 =>  (0x00007fff5ebff000)
	libmysqlclient.so.18 => /opt/mysql/lib/libmysqlclient.so.18 (0x00007faf7321b000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007faf72feb000)
	libodbcinst.so.2 => not found
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007faf72de6000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007faf72a27000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007faf7281e000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007faf7251e000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007faf72222000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007faf7200b000)
	/lib64/ld-linux-x86-64.so.2 (0x00007faf73a46000)

You are right, libmyodbc5w.so is linked dynamically to libmysqlclient.
I have thought that there may be a problem like this. Because of this
I have compiled the odbc driver myself following the instructions
from the readme file and from the mysql web site. libmyodbc5w.so is
the one that I compiled myself, not the one provided by Ubuntu.
[1 May 2013 9:55] Viorel Preoteasa
I managed to solve the problem by using the pre-compiled driver from
dev.mysql.com. However, probably the sources available from dev.mysql.com
should by default compile with static linking.

Thank you for your help.
[1 May 2013 10:11] Bogdan Degtyariov
The problem with linking is that the linker prefers using shared libraries rather than the static ones. This problem is being worked on in Worklog 6738. With the existing versions of Connector/ODBC driver you can workaround the issue by removing libmysqlclient.so from lib directory and keep only libmysqlclient.a.