Author Topic: Using MyODBC (ODBC connector for MySQL)  (Read 7731 times)

Offline resander

  • Multiple posting newcomer
  • *
  • Posts: 49
Using MyODBC (ODBC connector for MySQL)
« on: April 17, 2009, 08:00:13 pm »
Anyone done this using codeblocks?

I am just trying to get it working on Ubuntu 8.10 by:

 -  sudo apt-get install iodbc   (to get an ODBC managaer that configures Datasource names etc)
 -  sudo apt-get install libmyodbc (to get the library to /usr/lib/odbc/

Then put /usr/lib/odbc/ into Link-library list of Codeblocks via Projects->Buildoptions->select Linker tab and the Add button.

The db application linked OK, but the program stopped before entry to main outputting message '/home/ken/projects/ls/bin/Debug/ls: error while loading shared libraries: cannot open shared object file: No such file or directory'.

The sudo apt-get install libmyodbc does not generate a file named, so I downloaded a fairly recent ODBC .gz file from and installed. It contained several lib-files, one called that I renamed to The program still did not go into main. The same message appeared.

I am going around in circles here, so would be grateful for hints. 

Offline resander

  • Multiple posting newcomer
  • *
  • Posts: 49
Re: Using MyODBC (ODBC connector for MySQL)
« Reply #1 on: May 17, 2009, 06:30:57 pm »
I actually decided to use the unixODBC linux package.
This is either preinstalled for Ubuntu or available via Synaptic manager.
Info available at

unixODBC contains a Driver manager that is used at runtime to forward ODBC sql calls to db product drivers.

It also contains a GUI that allows a user to specify ODBC drivers and and dsns (data source names). The GUI only writes text to the odbc ini files, so there is no need to use it. Using a text editor is ok too.

To link to ODBC driver manager put /usr/lib/
into Project->Build Options->Linksettings

Then set the odbcinst.ini and odbc.ini files as follows:

Driver      = /usr/local/lib/
Description   = MyODBC 3.51 Driver

Driver      = MYSQL
SERVER      = localhost
PORT        =
USER        = root
Password    =
Database    =
OPTION      = 3
SOCKET      = /var/run/mysqld/mysqld.sock