docs.roxen.comView this page in a printer friendly mode
DocsRoxen2.1Administrator ManualInstallation
Copyright © 2001, Roxen Internet Software
Suggestions, comments & compliments
manuals@roxen.com
 DEMO  DOCS  PIKE
 COMMUNITY  DOWNLOAD
www.roxen.com

   

Software Installation
Creating a Site
Upgrading a 1.3 Site
Java Support
Databases

Databases

Roxen contains a generic database API, which is used to connect to a number of different SQL databases, through either a native or an ODBC driver. The native drivers are compiled into Pike.

Each database is then accessed trough a database URL with the format: driver://user:password@host[:port]/database. For example mysql://test:Test password@mysqlhost.roxen.com/test.

To check the database connectivity use the SQL tag module located in the database section, and configure a database path.


SQL tag module

If everything works the information tab will give information about which database you are connected to.


Connected

If everything does not work the information tab will give an error message. For example if could not find the correct driver.


No driver found

Or if it could connect to the database server, but the user name, password or database was wrong.


Wrong password

The database support can be used for many things within Roxen. The most common usage is to use RXML tags to produce output from a database. But other modules use the database connectivity as well. Usually you enter the whole database URL when you configure modules. But you don't really want to do that in each web page. Therefore the SQL Databases module can be used to give symbolic names to database URLs. In the pages it is only necessary to use the symbolic name. If the database moves it won't be necessary to change any pages.


Pike module list

To find out which database drivers are available in your Pike, use the Pike module list task under the Tasks tab. The available database drivers will be shown under Features.

Mysql

Native support, mysql://user:password@host:port/database. If the driver is compiled into your Pike you don't need to do anything further.

Msql

Native support, msql://user:password@host:port/database.

Postgres

Native support, postgres://user:password@host:port/database.

ODBC

ODBC is configured through a .odbc.ini file. The file is either found in the Roxen user's home directory or with the ODBCINI environment variable.

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


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

Name is a name set, that will be used to refer to this database. Driver is the path to the ODBC driver, in the form of a dynamic library. Option is various options that will be forwarded to the driver. Available options vary between drivers. Usual options include the network location of the database manager as well as the name and password of the database user.


[toronto_wp]
# white paper 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
Sample .odbc.ini file

The database URL for a ODBC database differs because you specify the name given to the database instead of the host name and port. Thus an odbc database URL looks like this: odbc://username:password@name/database.

Oracle

Oracle is supported through a native driver.

Sybase

Sybase is supported through a native driver.

Informix

Informix is supported through a native driver.

Mimer

Mimer is supported through its ODBC driver.