To connect to a database through PEAR::DB, you have to create a
valid DSN - data source name. This DSN
consists in the following parts:
phptype:
Database backend used in PHP (i.e. mysql
, odbc etc.)
dbsyntax:
Database used with regards to SQL syntax etc. When using ODBC as the
phptype, set this to the DBMS type the ODBC
driver is connecting to. Examples: access,
db2, mssql,
navision, solid, etc.
protocol:
Communication protocol to use ( i.e. tcp,
unix etc.)
hostspec:
Host specification (hostname[:port])
database:
Database to use on the DBMS server
username:
User name for login
password:
Password for login
proto_opts:
Maybe used with protocol
option:
Additional connection options in URI query string format.
options get separated by &
The format of the supplied DSN is in its fullest form:
dbase -> dBase
fbsql -> FrontBase (functional since DB 1.7.0)
ibase -> InterBase (functional since DB 1.7.0)
ifx -> Informix
msql -> Mini SQL (functional since DB 1.7.0)
mssql -> Microsoft SQL Server (NOT for Sybase. Compile PHP --with-mssql)
mysql -> MySQL (for MySQL <= 4.0)
mysqli -> MySQL (for MySQL >= 4.1) (requires PHP 5) (since DB 1.6.3)
oci8 -> Oracle 7/8/9
odbc -> ODBC (Open Database Connectivity)
pgsql -> PostgreSQL
sqlite -> SQLite
sybase -> Sybase
With an up-to-date version of DB, you can use a
second DSN format
Please note, that some features may be not supported by all
database backends. Please refer to the PEAR DB extensions
status document located at:
/pear/base/dir/DB/doc/STATUS
to get a detailed list about what features are supported by which
backend.