UnixODBC documentation / manpage

databasedocumentationman

Just wondering if there is any official documentation for unixODBC, e.g. how the configuration files have to look like and what parameters they expect? (I am using only a shell, no GUI) Even http://www.unixodbc.org/doc/ doesn't look very promising. I somehow have the impression, the best information are 3rd party pages, but can this be true?

Best Answer

You're right the documentation about unixODBC still rare. For the configurations files, unixODBC use only two config files:

  • /etc/odbcinst.ini : Here you define the driver

  • /etc/odbc.ini : Informations about connections

You can find a great documentation about installing this drivers and libraries on various linux systems here:

http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/installing_configuring_odbc.html

More complete documentation that include API for various languages can be found here:

http://www.easysoft.com/developer/interfaces/odbc/linux.html

All the config and installation stuff can be made without GUI :), an old good terminal shell suffice.

From a developer point a view (iused the C API few years ago, and i remember that it was a non trivial task): you need to connect and then perform a request.

  1. To connect to the datasource using unixODBC and the C API:

    • Init ODBC environnement by calling SQLAllocHandle()

    • Choose ODBC version number with SQLSetEnvAttr()

    • Again use SQLAllocHandle() to init the connection handle

    • Now you can connect by calling SQLConnect()

  2. Once you have a connection handle and have connected to a data source you allocate statement handles to execute SQL or retrieve meta data. As with the other handles you can set and get statement attributes with SQLSetStmtAttr and SQLGetStmtAttr.

here you can find a good documentation on the C API:

http://www.easysoft.com/developer/languages/c/odbc_tutorial.html http://www.easysoft.com/developer/languages/c/odbc-tutorial-fetching-results.html http://www.easysoft.com/developer/interfaces/odbc/diagnostics_error_status_codes.html

Related Question