v5:database:ibm_db2
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
database:ibm_db2 [2015/11/27 23:48] – mnewnham | v5:database:ibm_db2 [2017/05/17 18:38] – [db2oci] mnewnham | ||
---|---|---|---|
Line 10: | Line 10: | ||
^ADOdb V5|Yes| | ^ADOdb V5|Yes| | ||
^ADOdb V6|Yes| | ^ADOdb V6|Yes| | ||
+ | == Alternative Drivers == | ||
+ | [[v5: | ||
</ | </ | ||
===== Description ===== | ===== Description ===== | ||
- | This driver provides a connection to IBM DB2 Databases, using the IBM Data Client. | + | This driver provides a connection to IBM DB2 Databases, using the IBM Data Client. |
- | ===== Generic Driver Option Support ===== | + | ---------------------------------- |
- | |[[reference:adodb_fetch_mode|ADODB_FETCH_BOTH]]|Yes| | + | |
- | |[[reference:startTrans|Transactions]]|Yes| | + | |
- | |[[reference: | + | |
- | |[[reference: | + | |
- | + | ||
- | ===== Driver Specific Options ===== | + | |
- | --------------------------- | + | |
==== uCaseTables ==== | ==== uCaseTables ==== | ||
<WRAP right box> | <WRAP right box> | ||
Line 30: | Line 25: | ||
</ | </ | ||
- | This variable sets the keys in [[dictionary: | + | This variable sets the keys in [[v5:dictionary:metacolumns]],[[v5:dictionary:metaprimarykeys]] and [[v5:dictionary:metaforeignkeys]] to upper-case when retrieved. The default is true. |
<code php> | <code php> | ||
Line 41: | Line 36: | ||
</ | </ | ||
-------------------------------- | -------------------------------- | ||
+ | ------------------------------------------------------- | ||
===== Connection Example Using Instance ===== | ===== Connection Example Using Instance ===== | ||
- | < | + | <WRAP info> |
The DB2 database must be catalogued for a connection like this to work. | The DB2 database must be catalogued for a connection like this to work. | ||
</ | </ | ||
Line 61: | Line 57: | ||
$conn-> | $conn-> | ||
</ | </ | ||
- | ----------------------------------- | ||
- | <WRAP right box round 300px> | ||
- | == Specification == | ||
- | ^Driver Name|odbc_db2| | ||
- | ^Data Provider|odbc| | ||
- | ^Status|Inactive((This driver is not actively supported or enhanced by ADOdb project members, but you can provide fixes and enhancements if you have the expertise))| | ||
- | ^Windows|Yes| | ||
- | ^Unix|No| | ||
- | ^ADOdb V5|Yes| | ||
- | ^ADOdb V6|Yes| | ||
- | </ | ||
- | ==== odbc_db2 ==== | ||
- | Connects to DB2 database using either the IBM or 3rd party ODBC driver | ||
- | <WRAP tip> | ||
- | If the driver supports it setting the Cursor Type to '' | ||
- | To set SQL_CUR_USE_ODBC for drivers that require it, do this: | ||
- | <code php> | ||
- | $db = NewADOConnection(' | ||
- | $db-> | ||
- | $db-> | ||
- | </ | ||
- | </ | ||
- | <WRAP tip> | ||
- | == USING CLI INTERFACE == | ||
- | |||
- | There were reports that the $host and $database params have to be reversed in Connect() when using the CLI interface. | ||
- | </ | ||
- | |||
- | <WRAP tip> | ||
- | == System Error 5 == | ||
- | IF you get a System Error 5 when trying to Connect/ | ||
- | to DB2 full rights to the DB2 SQLLIB directory, and place the user in the DBUSERS group. | ||
- | |||
- | </ | ||
------------------------------ | ------------------------------ | ||
==== db2oci ==== | ==== db2oci ==== | ||
Line 102: | Line 64: | ||
^Driver Name|db2oci| | ^Driver Name|db2oci| | ||
^Data Provider|db2| | ^Data Provider|db2| | ||
- | ^Status|Active((This driver is actively supported by ADOdb project members))| | + | ^Status|Deprecated((This driver is deprecated as of ADOdb version 5.21 and will be removed in ADOdb version 6))| |
^Windows|Yes| | ^Windows|Yes| | ||
^Unix|Yes| | ^Unix|Yes| | ||
^ADOdb V5|Yes| | ^ADOdb V5|Yes| | ||
- | ^ADOdb V6|Yes| | + | ^ADOdb V6|No| |
</ | </ | ||
- | This driver re-maps ibm :0 bind variables to oracle compatible ? variables. Use this driver to enhance compatiblity between [[database:Oracle]] and DB2 drivers | + | This driver re-maps ibm :0 bind variables to oracle compatible ? variables. Use this driver to enhance compatiblity between [[v5:database:oracle]] and DB2 drivers. |
+ | |||
+ | The driver is deprecated. To write portable code that uses bind parameters and can be shared between DB2 and Oracle, use the [[v5: | ||
------------------------------------------------- | ------------------------------------------------- | ||
Line 158: | Line 122: | ||
Any table name containing special characters will need to be quoted in all queries. | Any table name containing special characters will need to be quoted in all queries. | ||
- | ==== Using metaCasing with DB2 ==== | ||
- | When using DB2, it is important to remember that when using [[dictionary: | ||
- | |||
- | Generally, development standards mean that table names in a database are created to a casing standard, for example, all upper-case or lower-case table and column names. In that case, metaCasing will work the same as in other databases, e.g. | ||
- | <code php> | ||
- | /* | ||
- | * Connection to DB2 smple database, accessing a table called ACT | ||
- | * Set the casing to lower case | ||
- | */ | ||
- | $db-> | ||
- | $cols = $db-> | ||
- | print_r($cols); | ||
- | /* | ||
- | * Prints | ||
- | Array( | ||
- | [0] => actno, | ||
- | [1] => actname, | ||
- | [2] => actdesc | ||
- | ) | ||
- | */ | ||
- | |||
- | </ | ||
- | ----------------- | ||
- | <WRAP right info 300px> | ||
- | These rules also apply to column naming | ||
- | </ | ||
- | ===== The Impact Of METACASE_NATIVE ===== | ||
- | Setting the metaCasing option to '' | ||
- | ==== Creating Tables ==== | ||
- | Consider the following case-sensitive table name: '' | ||
- | |||
- | ^MetaCase^Created As^SQL Retrieval^Presentation in MetaFunctions^ | ||
- | |METACASE_UPPER|ACCOUNTTABLE|SELECT FROM ACCOUNTTABLE, | ||
- | |METACASE_LOWER|ACCOUNTTABLE|SELECT FROM ACCOUNTTABLE, | ||
- | |METACASE_NATIVE|accountTable|SELECT FROM " | ||
- | |||
- | As shown, once a table is created in non-upper case when the metaCasing value is '' | ||
{{tag> | {{tag> |
v5/database/ibm_db2.txt · Last modified: 2024/05/25 04:30 by mnewnham