This document is a list of Frequently Asked Questions concerning the iODBC project. It is currently maintained by; please feel free to send nominations for FAQ-worthy topics to this address.


What does iODBC stand for?

As an acronym, iODBC is "Independent Open Database Connectivity". See About iODBC for more.

Under what license is iODBC available?

iODBC is dual-licensed under both the BSD and LGPL licenses.

Please see the License Page for more details.

How do I get support for iODBC

Support for iODBC is available through the mailing-lists, hosted by, where the wider community (and OpenLink employees) contribute to the best of their ability. The previous forum has been archived but may contain useful reference material. At some stage, OpenLink may start to offer commercial support.

What is the relationship between OpenLink Software and iODBC?

OpenLink Software ( ) is a software company specialising in data-access technology such as ODBC, JDBC etc. Products include UDA (ODBC, JDBC and .NET database-access drivers) and Virtuoso (a virtual-database and Web-services platform).

iODBC is an open-source project (released under the LGPL or BSD licenses) hosted by OpenLink Software for the benefit of the wider community, to implement and improve a free and Open ODBC Driver Manager component for Linux / Unix / VMS / MacOS X / platforms.

iODBC copyright is co-owned by Ke Jin and OpenLink Software. OpenLink are the sole project custodian and sponsor.

Advertising: OpenLink may benefit from the publicity of hosting, with its links to various vendors of ODBC drivers for assorted platforms and RDBMS, but we don't set out to abuse the open-source project for commercial gain. There are plenty enough free and open-source database-drivers for Free databases (mysql, postgresql, Firebird and maybe others). The OpenLink philosophy is to facilitate OS- and database-independent connectivity through ODBC, to which end having an open-source driver-manager component is advantageous.

Resources: various OpenLink employees work on actively developing and maintaining the authoritative CVS sources of the iODBC project, administering the server on which the site runs, maintaining the website, responding to posts on the public forums, etc.

Executive summary: think `nice .com hosts free .org' and you'll not be far from the truth.

What happened to the Forum Archive (wwwboard)?

After a long innings, wwwboard proved too susceptible to spam and other undesirable phenomena, and the underlying wwwboard implementation was unpleasant to maintain, becoming corrupt with increasing frequency. As such, it has been replaced with the mailing-lists, hosted by SourceForge.

In the process, the old wwwboard has been left in stasis; a small cleanup operation was mounted to remove off-topic and dubious / offensive / illegal material and links, but not extending as far as censorship: if someone said iODBC or OpenLink suck, you'll see it represented as-stated there.


What's an odbc.ini and what do I put in it?

An odbc.ini is the main configuration file in which all your DSNs and much of the ODBC configuration parameters are stored. iODBC has a search-path for finding such a configuration file: first, the environment variable ODBCINI is inspected to see if it points at a suitable file, or ~/.odbc.ini (analagous to User DSNs on Windows) then /etc/odbc.ini ("system-wide") are fall-back locations.

The odbc.ini file comprises 3 parts: a set of ODBC options, a list of DSNs, and then the datasource definitions themselves, thus:

[ODBC Data Sources]
PostgreSQL native localhost = PostgreSQL native driver
PostgreSQL OpenLink localhost = PostgreSQL over OpenLink multi-tier

[PostgreSQL native localhost]
Driver     = /usr/lib/postgresql/lib/
Host       = localhost
Server     = localhost
ServerName = localhost
Database   = tim
UserName   = tim
UID        = tim
Port       = 5432

[PostgreSQL OpenLink localhost]
Description     = PostgreSQL, over openlink MT
Driver          = /opt/openlink/lib/
ServerType      = PostgreSQL95
Host            = localhost
Database        = tim
Username        = tim
LastUser        = tim
User            = tim
FetchBufferSize = 99

;Trace = 1
;TraceFile = /tmp/odbctrace.log
;Debug = 1
;DebugFile = /tmp/odbcdebug.log

The list of ODBC Data Sources correlate with the file odbcinst.ini (or environment variable ODBCINSTINI): for every value used as a description of the driver there should be a corresponding section in odbcinst.ini listing both the Driver and Setup library (to assist with graphical configuration using iodbcadm-gtk, and also used to display an input box in the event of insufficient options being presented at connection-time).

The list of attributes is driver-dependent, as the above shows: the native postgresql driver calls them different things from openlink multi-tier, so you have to check with your driver's documentation.

With iODBC, assuming you downloaded/installed/compiled it, you also have a GTK-based GUI for configuring your ODBC DSNs, too: run iodbcadm-gtk.

Just get me connected!

This is the succinct overview:

Grab the source. Unpack it. Run ./configure && nice make && sudo make install. Install an ODBC driver for your backend database. Configure odbc.ini to use this driver. Export the environment variable ODBCINI to point to that odbc.ini. Run iodbctest and attempt to connect. Voila.

I've got this linux box with PHP and Apache...

...and you want to connect to SQL Server or MS Access from it. The overview of the architecture is as follows: apache invokes php to handle scripts, php is linked against libiodbc in order to handle the odbc_* functions in your script, libiodbc loads either a native SQL Server driver for linux or some generic ODBC-proxy for MS Access, and you're done.

OpenLink produce an `odbc agent' that facilitates the latter sort of connection.

The iODBC+PHP+Apache HOWTO document on this site will guide you through a working set of configure options for libiodbc, apache and php in order.

What's a libiodbc and what goes in my Driver= lines in odbc.ini?

The ODBC architecture separates the application, the driver-manager and the driver components, each one calling the next in a chain.

The library only implements a driver manager; you need a separate driver for each kind of backend database to which you connect, but your application will at least see one consistent interface across all of them. If you attempt to use in the odbc.ini, it will fail.

The Driver= parameter should be a full name to a shared-library implementing the driver for the backend database to which you're connecting:

Driver     = /usr/local/lib/
Port       = 5432
ServerName = localhost
Database   = me
UserName   = me
Password   =

Description     = PostgreSQL, over openlink multi-tier
Driver          = /opt/openlink/bin/
ServerType      = PostgreSQL95
Host            = otherbox
Database        = me
Username        = me
FetchBufferSize = 99

Note that other driver-managers permit use of { } for quotations and symbolic names for the driver (referencing the odbcinst.ini file), such as

Driver = {SQL Server}

Currently iODBC implements neither of these; the Driver= parameter must be a full path to the shared library directly.

Common Error Messages

[iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded, SQLSTATE=IM002

There are several reasons why this message could occur. The best solution is to trace through what's happening: your application has been linked against libiodbc, which has tried to find an odbc.ini file one way or another - either through the ODBCINI environment variable or the fall-back paths (typically /etc/odbc.ini, depending on how it was compiled). You should check that such a file exists in a suitable location, and that it is accessible (particularly if your application runs with different user privileges - such as apache/php running as a www-data user).

Additionally, it could be that iODBC has found a suitable odbc.ini file, but none of the file(s) found contain the DSN you've requested. Check the syntax of your request - is the ODBC connect-string correct, and does the DSN you're requesting exist? See also the section of this FAQ, above, entitled `What's an odbc.ini and what do I put in it?'.

[iODBC] [Driver Manager]Specified driver could not be loaded

As in the previous error case, there are a few reasons why this could occur, and thinking through the architecture helps. Your application has loaded libiodbc successfully, and it has found an odbc.ini file (or equivalent through the ODBCINI environment variable), and it has found a DSN within that odbc.ini that matches the name requested in your connection.

However, the driver manager has had problems loading the library specified in the `Driver=' line of that DSN definition. Either it doesn't exist, or its permissions are insufficient to allow your application to load it (it must be readable and executable, and the directories leading down to it must be executable), or maybe the file is not a dynamic library - it could be a static library (a *.a file except on AIX) or is otherwise corrupted. These are all things to check, or you may be best off reinstalling the driver if all the permissions check out.

Note also the prior point: the Driver= parameter must be the full path to a shared-library (*.so) implementing an ODBC driver for the database to which you're connecting.

Driver-Specific Errors

MyODBC: [TCX][MyODBC]No DSN entered (0) SQLSTATE=S1000

This error is raised whenever you attempt to connect to MyODBC using the SQLDriverConnect() function with the SQL DRIVER_PROMPT option. Normally, SQL_DRIVER_PROMPT means the driver should invoke a graphical dialog to request missing information (`DSN=', or username and password if not included); however, MyODBC has no graphical library and does not distinguish the case that a graphical prompt is unavailable from when there is insufficient information, so you always see this error message.

iodbctest and iodbctestw from versions 3.52.1 and 3.52.2 both request connections using SQL DRIVER_PROMPT, causing this problem with MyODBC.

The workaround is to edit iodbctest.c such that the SQLDriverConnect() and SQLDriverConnectW() calls use SQL DRIVER_COMPLETE instead. This still allows drivers with graphical setup routines to ask for additional information, but works better with drivers that have no graphical routines, such as MyODBC. See the following diff:

Index: iodbctest.c
RCS file: /opldev/opensource/iODBC/samples/iodbctest.c,v
retrieving revision 1.22
retrieving revision 1.21
diff -u -u -r1.22 -r1.21
--- iodbctest.c 2005/07/19 10:19:01     1.22
+++ iodbctest.c 2005/02/15 17:08:13     1.21
@@ -297,12 +297,12 @@
#ifdef UNICODE
strcpy_A2W (wdataSource, (char *) dataSource);
status = SQLDriverConnectW (hdbc, 0, (SQLWCHAR *) wdataSource, SQL_NTS,
-      (SQLWCHAR *) outdsn, NUMTCHAR (outdsn), &buflen, SQL_DRIVER_COMPLETE);
+      (SQLWCHAR *) outdsn, NUMTCHAR (outdsn), &buflen, SQL_DRIVER_PROMPT);
if (status != SQL_SUCCESS)
ODBC_Errors ("SQLDriverConnectW");
status = SQLDriverConnect (hdbc, 0, (SQLCHAR *) dataSource, SQL_NTS,
-      (SQLCHAR *) outdsn, NUMTCHAR (outdsn), &buflen, SQL_DRIVER_COMPLETE);
+      (SQLCHAR *) outdsn, NUMTCHAR (outdsn), &buflen, SQL_DRIVER_PROMPT);
if (status != SQL_SUCCESS)
ODBC_Errors ("SQLDriverConnect");

This change will be included in the up-coming iODBC 3.52.3 release.

Segfault with Perl DBD::ODBC

Certain platforms (most notably Debian GNU/Linux 5.0.4 ("Lenny", currently stable)) ship with version 1.13-5 of Perl's DBD::ODBC module. On 64-bit OSs, this has a bug that causes a segfault. The solution is to upgrade to at least 1.17 (may be found in "Squeeze", currently the Testing distribution).

Tracing Application Behaviour

In the above odbc.ini snippet, we saw commented-out lines concerning tracing. These lines would enable us to analyse what ODBC calls the driver manager sees an application makes, detail including parameters and return states etc.

To enable this, uncomment the lines in your odbc.ini:

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

As of iODBC version 3.51.0 and above, the TraceFile option now understands a handful of variables:

$P        Process ID
$U        User ID under which the process is currently running
$T        Timestamp in YYYYMMDDHHMMSS format
$H        Home directory of the user that started the process

Also from version 3.52.7 onwards, TraceFile now takes an option

$S        Sequence number

These are case-insensitive. Hence you could specify


and it would include your userid, the application process-id and timestamp in the trace log filename.

Tracing Application Behaviour

As of release 3.52.5, iODBC has support for File DSNs - where the connection parameters are stored in a separate file per DSN, under a standard directory.

To configure these, either use the `FileDSN' tab alongside System and User DSNs in the iODBC graphical administrator (iodbcadm-gtk or the Mac OS X GUI), or edit files in /etc/ODBCDataSources/ for yourself.

Note that this directory must have suitable permissions for those you wish to be able to create, edit and remove files to do so. For example, 1775 might be suitable - the owner and members of the group owning the directory can create, remove and edit their own DSNs but not those owned by a different user.

To use a File DSN, replace the DSN= parameter in your ODBC connection string with FileDSN=, for example

iodbctest FileDSN=localvirtuoso;UID=dba;PWD=secret