ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:database:ibm_db2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v5:database:ibm_db2 [2019/12/09 03:19] mnewnhamv5:database:ibm_db2 [2023/01/24 03:53] (current) mnewnham
Line 13: Line 13:
 == Alternative Drivers == == Alternative Drivers ==
 [[v5:database:odbc#odbc_db2|ODBC Driver For IBM DB2]]\\ [[v5:database:odbc#odbc_db2|ODBC Driver For IBM DB2]]\\
 +== See Also ==
 +[[v5:reference:connection:setconnectionparameter#ibmdb2|setConnectionParameter()]]
 </WRAP> </WRAP>
 ===== Description ===== ===== Description =====
 This driver provides a connection to IBM DB2 Databases, using the IBM Data Client. This driver replaces the original [[v5:database:odbc#odbc_db2|DB2 ODBC]] driver. This driver provides a connection to IBM DB2 Databases, using the IBM Data Client. This driver replaces the original [[v5:database:odbc#odbc_db2|DB2 ODBC]] driver.
 == PHP Drivers For Windows == == PHP Drivers For Windows ==
-PHP 7 drivers for windows are currently available [[https://github.com/ibmdb/php_ibm_db2|here]] +PHP 7 and 8 drivers for windows are currently available [[https://github.com/ibmdb/php_ibm_db2|here]] 
  
 ---------------------------------- ----------------------------------
Line 45: Line 47:
 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.
 </WRAP> </WRAP>
 +==== Building a catalog entry ====
 +This is a simple example building a catalogued connection from a windows client to a remote DB2 server running on a machine named adodb-db2.local. The server is running on port 25010. We will add a DSN entry called //**adodb-test**//
 +
 +<code>
 +db2cli writecfg add -database SAMPLE -host adodb-db2.local -port 25010 
 +db2cli writecfg add -dsn adodb-test -database SAMPLE -host adodb-db2.local -port 25010
 +</code>
 +To use this DSN
 <code php> <code php>
 include '../adodb/adodb.inc.php'; include '../adodb/adodb.inc.php';
-$database = 'SAMPLE';+$dsn = 'adodb-test';
 $user = 'db2inst1'; $user = 'db2inst1';
 $password = 'instance'; $password = 'instance';
 $conn = ADOnewConnection('db2'); $conn = ADOnewConnection('db2');
-$conn->connect($database, $user, $password);+$conn->connect($dsn, $user, $password);
 </code> </code>
  
Line 57: Line 67:
 <code php> <code php>
 include '../adodb/adodb.inc.php'; include '../adodb/adodb.inc.php';
-$dsn = 'hostname=192.168.0.30;protocol=tcpip;port=50000;database=SAMPLE;uid=db2inst1;pwd=instance';+$dsn = 'hostname=adodb-db2.local;protocol=tcpip;port=25010;database=SAMPLE;uid=db2inst1;pwd=instance';
 $conn = ADOnewConnection('db2'); $conn = ADOnewConnection('db2');
 $conn->connect($dsn); $conn->connect($dsn);
Line 93: Line 103:
 </WRAP> </WRAP>
 This driver provides undocumented bind variable mapping from ibm to oracle.The functionality appears to overlap the db2_oci driver This driver provides undocumented bind variable mapping from ibm to oracle.The functionality appears to overlap the db2_oci driver
-{{tag>[ibm db2]}}+{{tag>[ibm db2 tier1]}}
  
 ===== Case Sensitivity In Table And Column Names ===== ===== Case Sensitivity In Table And Column Names =====
v5/database/ibm_db2.1575857977.txt.gz · Last modified: 2019/12/09 03:19 by mnewnham