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 firstname.lastname@example.org/test.
To check the database connectivity use the SQL tag module located in the database section, and configure a database path.
If everything works the information tab will give information about which database you are connected to.
If everything does not work the information tab will give an error message. For example if could not find the correct driver.
Or if it could connect to the database server, but the user name, password or database was wrong.
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.
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.
Oracle 7 and 8 are supported through a native driver. This requires that the Oracle client libraries (OCI) are installed. (If installing Roxen from the source distribution, Oracle and OCI must be installed before Roxen.)
URL format: oracle://user:password@SID/
The SID is the Oracle Server ID, and may be omitted to access the default server. Optionally, a tablespace identified may be added after the final slash.
Sybase is supported through a native driver.
Native support, mysql://user:password@host:port/database. If the driver is compiled into your Pike you don't need to do anything further.
Native support, msql://user:password@host:port/database.
Native support, postgres://user:password@host:port/database.
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 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.
# white paper of metro Toronto
Driver = /usr/lib/odbc/oracle.so
# NNTP netnews group
Driver = /usr/lib/odbc/nnodbc.so
Server = news.empress.com
# 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.
Informix is supported through a native driver.
Mimer is supported through its ODBC driver.