SunshinePHP Developer Conference 2015

PDO_FIREBIRD DSN

(PECL PDO_FIREBIRD >= 0.1.0)

PDO_FIREBIRD DSNConnecting to Firebird databases

Description

The PDO_FIREBIRD Data Source Name (DSN) is composed of the following elements:

DSN prefix

The DSN prefix is firebird:.

dbname

The name of the database.

charset

The character set.

role

The SQL role name.

Examples

Example #1 PDO_FIREBIRD DSN example with path

The following example shows a PDO_FIREBIRD DSN for connecting to Firebird databases:

firebird:dbname=/path/to/DATABASE.FDB

Example #2 PDO_FIREBIRD DSN example with port and path

The following example shows a PDO_FIREBIRD DSN for connecting to a Firebird database using hostname port and path:

firebird:dbname=hostname/port:/path/to/DATABASE.FDB

Example #3 PDO_FIREBIRD DSN example with localhost and path to employee.fdb on Debian system

The following example shows a PDO_FIREBIRD DSN for connecting to a Firebird database employee.fdb using localhost:

firebird:dbname=localhost:/var/lib/firebird/2.5/data/employee.fdb

add a note add a note

User Contributed Notes 2 notes

up
0
nelson at integrasoftware dot com dot br
6 years ago
my Firebird connection example:

$str_conn = "firebird:dbname=C:\db\banco.gdb;host=localhost";
    
$dbh = new PDO($str_conn, "SYSDBA", "masterkey");
up
-4
jon at 3blooms dot net
1 year ago
A more complete description of the PDO DSN for accessing a remote server instance of Firebird:

firebird:dbname=hostname/port:database_name

Example:

firebird:dbname=localhost/3050:C:\PKS4\Data\testdb.fdb

Of course, properly escape the backslashes in the database file path, or use a single-quoted string.
To Top