Using Database Module (agdb)

To use agdb, you must first install the iODBC driver manager before configuring and installing AGLIB. See Components of AGLIB and required third-party packages for more information on agdb and see Installation for installation information. You also need to install a database server (such as MySQL) and its ODBC driver (such as MyODBC).

The system was tested under the following configuration:

MySQL-3.23.33 or above
MyODBC-2.50.36 or above
libiodbc-2.50.3 or above
(Note: if you are installing iODBC RPMs, you need both iODBC Driver Manager Runtime Package and iODBC RPM Developers Kit)

Recommended installation procedure:

  1. Install latest MySQL (avaliable at
  2. Install latest MyODBC (avaliable at
  3. Install latest iODBC (avaliable at
  4. Configure your MySQL:
    1. create database (which will contain tables for AGLIB)
    2. create user account to access the database server (if you don't have one)
    3. grant user read and write access to the database created.
  5. Use <Your iODBC DIR>/samples/odbctest to test if you have everything setup correctly. See below for an explaination of connect string.
  6. Run configure and make of your AGLIB, with agdb enabled.
  7. Run <AGLIB DIR>/scripts/CreateAGTables to create AG tables.
  8. Run <AGLIB DIR>/demo/agdb_demo to see if everything works correctly. It's working well if you don't see any error message.

ODBC uses connection strings to connect to database servers. A connection string contains information such as hostname, database name, user name, password etc.

The following table shows some of the parameters used in a connect string, for a complete list, see

ODBC connect string arguments What the argument specifies
DSN Registered ODBC Data Source Name.
SERVER The hostname of the database server.
UID User name as established on the server. In SQL Server this is the logon name.
PWD Password that corresponds with the logon name.
DATABASE Database to connect to. If not given, DSN is used.

DSN is the registered ODBC Data Source Name, it should be defined in your ~/.odbc.ini file. All other arguments can be either defined in .odbc.ini file, or defined in the connect string itself.

To gain access to most ODBC data sources, you must provide a valid User ID and corresponding password. These values are initially registered by the database administrator.

Probably the easiest way is to define every argument in file .odbc.ini under your home directory. The following is a sample entry for DSN 'talkbank' in the configuration file for iODBC. To simplify the explanation line numbers have been included. Please note that UID and PWD become USER and PASSWORD, respectively, in iODBC's configuration file.

1  [talkbank]
2  Driver   = /pkg/ldc/lib/
3  DSN      = talkbank
4  SERVER   =
5  USER     = myuserid
6  PASSWORD = mypasswd
7  DATABASE = talkbank

Line 1 is the name of the driver section, which is 'talkbank'. You can have multiple driver sections in one configuration file. Line 2 specifies the odbc driver to use. Line 3 gives the name of the DSN, which is 'talkbank'. Line 4 specifies the hostname of the machine on which the database server is running. Line 5 is the user name to use to connect to the server. Line 6 is the password associated with the user name. Line 7 is the database to connect to.

If you have all required arguments specified in your .odbc.ini file like the one above, the connect string can simply be:


If you have not specified some of the arguments, say USER and PASSWORD, in the configuration file, you can still specify them in your connect string:


Annotation Graph Toolkit