v5:database:pdo
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
v5:database:pdo [2018/07/09 00:40] – mnewnham | v5:database:pdo [2019/12/28 02:17] – [pdo_oci] mnewnham | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PDO ====== | ====== PDO ====== | ||
~~NOTOC~~ | ~~NOTOC~~ | ||
- | <WRAP right box> | ||
- | == See Also == | ||
- | [[http:// | ||
- | </ | ||
===== Description ===== | ===== Description ===== | ||
- | This driver supports connections using the standardized [[http:// | + | This driver supports connections using the standardized [[http:// |
- | + | ||
- | * pdo_mssql (SQL Server with FREETDS) | + | |
- | * pdo_mysql (MySQL) | + | |
- | * pdo_oci (Oracle) | + | |
- | * pdo_pgsql (Postgresql) | + | |
- | * pdo_sqlite (SQLite) | + | |
- | * pdo_sqlsrv (SQL Server with Windows) | + | |
+ | ^PHP Driver^Description^ADOdb Connector^ | ||
+ | |pdo_firebird|Firebird|firebird| | ||
+ | |pdo_mssql|SQL Server with FREETDS|mssql| | ||
+ | |pdo_mysql|MySQL|mysql| | ||
+ | |pdo_oci|Oracle|oci| | ||
+ | |pdo_pgsql|Postgresql|pgsql| | ||
+ | |pdo_sqlite|SQLite|sqlite| | ||
+ | |pdo_sqlsrv|SQL Server using Windows Native Client|sqlsrv| | ||
+ | |||
===== Establishing A Connection ===== | ===== Establishing A Connection ===== | ||
To establish a connection, the **//DSN//** style of connection must be used, the first argument of the DSN string being the database type, e.g. to connect to a MySQL database: | To establish a connection, the **//DSN//** style of connection must be used, the first argument of the DSN string being the database type, e.g. to connect to a MySQL database: | ||
Line 23: | Line 21: | ||
$user = ' | $user = ' | ||
$password = ' | $password = ' | ||
- | $dsnString= ' | + | $dsnString= ' |
$db-> | $db-> | ||
Line 40: | Line 38: | ||
<WRAP right box round 300px> | <WRAP right box round 300px> | ||
== Preferred Driver == | == Preferred Driver == | ||
+ | [[v5: | ||
[[v5: | [[v5: | ||
== Specification == | == Specification == | ||
Line 50: | Line 49: | ||
^ADOdb V6|Yes| | ^ADOdb V6|Yes| | ||
</ | </ | ||
- | The current status of this driver is unknown | + | The current status of this driver is unknown. Consider using the [[v5: |
------------------------------------------ | ------------------------------------------ | ||
==== pdo_mysql ==== | ==== pdo_mysql ==== | ||
Line 65: | Line 64: | ||
^ADOdb V6|Yes| | ^ADOdb V6|Yes| | ||
</ | </ | ||
+ | |||
* Some **// | * Some **// | ||
- | ==== Sample Connection String | + | |
+ | ------------------------------------------------------- | ||
+ | === Sample Connection String === | ||
<code php> | <code php> | ||
include ' | include ' | ||
- | $db = ADOnewConnection(' | + | $db |
+ | |||
+ | $dsn = ' | ||
$user = ' | $user = ' | ||
$password = ' | $password = ' | ||
- | $db-> | + | |
+ | $db-> | ||
</ | </ | ||
---------------------------------------------- | ---------------------------------------------- | ||
Line 83: | Line 88: | ||
^Driver Name|pdo| | ^Driver Name|pdo| | ||
^Data Provider|pdo| | ^Data Provider|pdo| | ||
- | ^Status|Inactive((This driver is not supported by ADOdb project members, but you can contribute to this driver if you have the expertise))| | + | ^Status|Active((This driver is supported by ADOdb project members))| |
^Windows|Yes| | ^Windows|Yes| | ||
- | ^Unix|No| | + | ^Unix|Yes| |
^ADOdb V5|Yes| | ^ADOdb V5|Yes| | ||
^ADOdb V6|Yes| | ^ADOdb V6|Yes| | ||
</ | </ | ||
- | The current status of this driver | + | == Limitations == |
+ | |||
+ | |||
+ | * There is no support for the complex binding features available in the Native Driver | ||
+ | * Some MetaFunctions are unavailable | ||
+ | |||
+ | ---------------------------------------- | ||
+ | === Sample Connection String === | ||
+ | If you are using the instantclient, | ||
+ | <code php> | ||
+ | |||
+ | // | ||
+ | $tns = " | ||
+ | (DESCRIPTION = | ||
+ | (ADDRESS_LIST = | ||
+ | (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.86.86)(PORT = 1521)) | ||
+ | ) | ||
+ | (CONNECT_DATA = | ||
+ | (SERVICE_NAME = XEPDB1) | ||
+ | ) | ||
+ | ) | ||
+ | "; | ||
+ | $dsnString=" | ||
+ | $db-> | ||
+ | |||
+ | </ | ||
------------------------------------------ | ------------------------------------------ | ||
==== pdo_pgsql ==== | ==== pdo_pgsql ==== | ||
Line 98: | Line 128: | ||
^Driver Name|pdo| | ^Driver Name|pdo| | ||
^Data Provider|pdo| | ^Data Provider|pdo| | ||
- | ^Status|Inactive((This driver is not supported by ADOdb project members, but you can contribute to this driver if you have the expertise))| | + | ^Status|Active((This driver is supported by ADOdb project members))| |
^Windows|Yes| | ^Windows|Yes| | ||
- | ^Unix|No| | + | ^Unix|Yes| |
^ADOdb V5|Yes| | ^ADOdb V5|Yes| | ||
^ADOdb V6|Yes| | ^ADOdb V6|Yes| | ||
</ | </ | ||
- | The current status of this driver is unknown | + | === Status === |
+ | Some features are not supported | ||
+ | --------------------------------------------------------------- | ||
+ | === Sample Connection String === | ||
+ | <code php> | ||
+ | $db = newAdoConnection(' | ||
+ | |||
+ | $dsn = ' | ||
+ | $user = ' | ||
+ | $pass = ' | ||
+ | |||
+ | $db-> | ||
+ | </ | ||
----------------------------------------------- | ----------------------------------------------- | ||
==== pdo_sqlite ==== | ==== pdo_sqlite ==== | ||
Line 119: | Line 162: | ||
^ADOdb V6|Yes| | ^ADOdb V6|Yes| | ||
</ | </ | ||
- | + | ---------------------------------------------------------------- | |
- | ==== Sample Connection String | + | === Sample Connection String === |
<code php> | <code php> | ||
include ' | include ' | ||
$db = ADOnewConnection(' | $db = ADOnewConnection(' | ||
- | $db-> | + | |
+ | $dsn = ' | ||
+ | $user = ' | ||
+ | |||
+ | $db-> | ||
</ | </ | ||
- | --------------------------------------- | + | |
+ | ------------------------------------------------- | ||
==== pdo_sqlsrv ==== | ==== pdo_sqlsrv ==== | ||
<WRAP right box round 300px> | <WRAP right box round 300px> | ||
Line 150: | Line 199: | ||
---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ||
- | ==== Sample Connection String | + | === Sample Connection String === |
<code php> | <code php> | ||
include ' | include ' | ||
$db = ADOnewConnection(' | $db = ADOnewConnection(' | ||
+ | |||
$user = ' | $user = ' | ||
- | $password | + | $pass = ' |
- | $db-> | + | $dsn =' |
+ | |||
+ | $db-> | ||
</ | </ | ||
+ | ----------------------------------------------------------------------------- | ||
+ | ==== pdo_firebird ==== | ||
+ | <WRAP info> | ||
+ | This driver is available from version 5.21 | ||
+ | </ | ||
+ | <WRAP right box round 300px> | ||
+ | == Native Driver == | ||
+ | [[v5: | ||
+ | == Specification == | ||
+ | ^Driver Name|pdo| | ||
+ | ^Data Provider|pdo| | ||
+ | ^Status|Active((This driver is supported by ADOdb project members))| | ||
+ | ^Windows|Yes| | ||
+ | ^Unix|Yes| | ||
+ | ^ADOdb V5|Yes| | ||
+ | ^ADOdb V6|Yes| | ||
+ | </ | ||
+ | Unlike other pdo drivers, pdo_firebird is the preferred driver for this database. This is due to specific issues with this driver reported [[https:// | ||
+ | ------------------------------------------------------------ | ||
+ | === Sample Connection String === | ||
+ | |||
+ | <code php> | ||
+ | include ' | ||
+ | $db = ADOnewConnection(' | ||
+ | |||
+ | $dsn = ' | ||
+ | $user = ' | ||
+ | $pass = ' | ||
+ | |||
+ | $db-> | ||
+ | |||
+ | </ |
v5/database/pdo.txt · Last modified: 2022/02/20 23:47 by mnewnham