docs.roxen.com
main | demo | docs
download | community | pike
© 2000 Roxen Internet Software
Suggestions, Comments or Complaints
manuals@roxen.com

DocsRoxen2.0Administrator ManualDatabases
   

  • ODBC
  • SQL tag module
  • SQL databases
  • ODBC

    To connect to a database through ODBC is a bit different from using the databases supportred natively. You need to install a ODBC driver for the database and then configure it to connect to your database manager. On Windows the configuration is simple and done through the ODBC control panel.

    On Unix the configuration is done through an .odbc.ini file. The .odbc.ini file is usually found in the home directory of the user Roxen was started as. It can also be specified in the ODBCINI environment variable.

    .odbc.ini

    The .odbc.ini file can contain configurations for several databases. The syntax is as follows:


    [name]
    Driver = path
    option = value
    ...

    Name is the name you give the database. Driver is the path to the ODBC driver, in form of a dynamic library. Option is various options that will be forwarded to the driver. Which options are available differ between different drivers. Usually the location of the database manager and maybe the name and password of the database user.

    An example of a .odbc.ini file:


    [toronto_wp]
    # white page of metro Toronto
    Driver = /usr/lib/odbc/oracle.so
    <....>

    [netnews]
    # NNTP netnews group
    Driver = /usr/lib/odbc/nnodbc.so
    Server = news.empress.com

    [rnd_test]
    # data source for R&D test
    Driver = /home/r_d/odbc/empodbc.so
    URL = empodbc://rnd.empress.com:6322/rnd_test/testdb

    Database URL

    The database URL for a database reached through ODBC is odbc://user name:password@name/database, where name is the name given the database in the .odbc.ini file or the ODBC control panel. Instead of writing the database user and password in the database URL you can write them as options in the .odbc.ini file.