Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

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

Hope this help.

share|improve this answer
    
thank you very much TOC, I don't need it for programming, just for asterisk, where your link comes in handy, great :-) –  stefan.at.wpf Aug 19 '12 at 12:56
    
Thanks, welcome :) –  TOC Aug 19 '12 at 13:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.