Is there compatible ODBC driver with Mariadb 10 on Linux?

2.2k views Asked by At

I tried to use MySQL ODBC driver but that resulted in an error when I compile. MySQL ODBC driver is fine with Mariadb 5.5 but not Mariadb 10. So is there ODBC driver for Mariadb 10?

I installed MySQL Connector ODBC Driver source code version.

The follow is error messages:

* MySQL Connector ODBC Driver 5.3.4    
    Scanning dependencies of target myodbc5a
    [  6%] Building C object driver/CMakeFiles/myodbc5a.dir/catalog.c.o
    [  7%] Building C object driver/CMakeFiles/myodbc5a.dir/catalog_no_i_s.c.o
    /myodbc/mysql-connector-odbc-5.3.4-src/driver/catalog_no_i_s.c:1096:69: error: macro "my_init_dynamic_array" requires 5 arguments, but only 4 given
    /myodbc/mysql-connector-odbc-5.3.4-src/driver/catalog_no_i_s.c: In function 'foreign_keys_no_i_s':
    /myodbc/mysql-connector-odbc-5.3.4-src/driver/catalog_no_i_s.c:1096: error: 'my_init_dynamic_array' undeclared (first use in this function)
    /myodbc/mysql-connector-odbc-5.3.4-src/driver/catalog_no_i_s.c:1096: error: (Each undeclared identifier is reported only once
    /myodbc/mysql-connector-odbc-5.3.4-src/driver/catalog_no_i_s.c:1096: error: for each function it appears in.)
    make[2]: *** [driver/CMakeFiles/myodbc5a.dir/catalog_no_i_s.c.o] 오류 1
    make[1]: *** [driver/CMakeFiles/myodbc5a.dir/all] 오류 2
    make: *** [all] 오류 2

* MySQL Conncector ODBC Driver 5.2.7
    [  5%] Built target myodbc-util
    Scanning dependencies of target myodbc5a
    [  6%] Building C object driver/CMakeFiles/myodbc5a.dir/catalog.c.o
    [  8%] Building C object driver/CMakeFiles/myodbc5a.dir/catalog_no_i_s.c.o
    /myodbc/mysql-connector-odbc-5.2.7-src/driver/catalog_no_i_s.c:1096:69: error: macro "my_init_dynamic_array" requires 5 arguments, but only 4 given
    /myodbc/mysql-connector-odbc-5.2.7-src/driver/catalog_no_i_s.c: In function 'foreign_keys_no_i_s':
    /myodbc/mysql-connector-odbc-5.2.7-src/driver/catalog_no_i_s.c:1096: error: 'my_init_dynamic_array' undeclared (first use in this function)
    /myodbc/mysql-connector-odbc-5.2.7-src/driver/catalog_no_i_s.c:1096: error: (Each undeclared identifier is reported only once
    /myodbc/mysql-connector-odbc-5.2.7-src/driver/catalog_no_i_s.c:1096: error: for each function it appears in.)
    make[2]: *** [driver/CMakeFiles/myodbc5a.dir/catalog_no_i_s.c.o] 오류 1
    make[1]: *** [driver/CMakeFiles/myodbc5a.dir/all] 오류 2
    make: *** [all] 오류 2

* MySQL Conncector ODBC Driver 5.1.13
    [  9%] Building C object driver/CMakeFiles/myodbc5.dir/ansi.c.o
    [ 11%] Building C object driver/CMakeFiles/myodbc5.dir/catalog.c.o
    [ 12%] Building C object driver/CMakeFiles/myodbc5.dir/catalog_no_i_s.c.o
    [ 14%] Building C object driver/CMakeFiles/myodbc5.dir/connect.c.o
    [ 16%] Building C object driver/CMakeFiles/myodbc5.dir/cursor.c.o
    [ 18%] Building C object driver/CMakeFiles/myodbc5.dir/desc.c.o
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c:66:66: error: macro "my_init_dynamic_array" requires 5 arguments, but only 4 given
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c: In function 'desc_alloc':
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c:66: error: 'my_init_dynamic_array' undeclared (first use in this function)
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c:66: error: (Each undeclared identifier is reported only once
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c:66: error: for each function it appears in.)
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c: In function 'MySQLSetDescField':
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c:778: warning: cast from pointer to integer of different size
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c:786: warning: cast from pointer to integer of different size
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c:895:57: error: macro "my_init_dynamic_array" requires 5 arguments, but only 4 given
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c: In function 'MySQLCopyDesc':
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c:893: error: 'my_init_dynamic_array' undeclared (first use in this function)
    make[2]: *** [driver/CMakeFiles/myodbc5.dir/desc.c.o] 오류 1
    make[1]: *** [driver/CMakeFiles/myodbc5.dir/all] 오류 2
    make: *** [all] 오류 2
1

There are 1 answers

1
Hartmut Holzgraefe On

Gentoo seems to have a patch for this:

http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-db/myodbc/files/5.2.7-mariadb-dynamic-array.patch?view=markup

The problem was introduced with the addition of per-thread memory usage statistics ( https://mariadb.atlassian.net/browse/MDEV-4011 ) which required the addition of an additional parameter to the my_init_dynamic_array() macro. This macro isn't defined as part of the public client API, but is exposed in the my_sys.h header file nonetheless and is used by MySQL ODBC, so this change broke the ODBC code when compiled against recent MariaDB versions.

Alternatives are applying above patch, or switching to the MariaDB ODBC driver (which is still in beta though):

https://mariadb.com/kb/en/mariadb/client-libraries/mariadb-odbc-driver/