v5:database:ibm_db2
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
v5:database:ibm_db2 [2020/01/13 12:37] – Add tier1 tag dregad | v5:database:ibm_db2 [2024/05/25 04:30] (current) – [Connection Example Using DSN] mnewnham | ||
---|---|---|---|
Line 13: | Line 13: | ||
== Alternative Drivers == | == Alternative Drivers == | ||
[[v5: | [[v5: | ||
+ | == See Also == | ||
+ | [[v5: | ||
</ | </ | ||
===== Description ===== | ===== Description ===== | ||
This driver provides a connection to IBM DB2 Databases, using the IBM Data Client. This driver replaces the original [[v5: | This driver provides a connection to IBM DB2 Databases, using the IBM Data Client. This driver replaces the original [[v5: | ||
== PHP Drivers For Windows == | == PHP Drivers For Windows == | ||
- | PHP 7 drivers for windows are currently available [[https:// | + | PHP 7 and 8 drivers for windows are currently available [[https:// |
---------------------------------- | ---------------------------------- | ||
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. | ||
</ | </ | ||
+ | ==== 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 // | ||
+ | |||
+ | < | ||
+ | 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 | ||
+ | </ | ||
+ | To use this DSN | ||
<code php> | <code php> | ||
include ' | include ' | ||
- | $database | + | $dsn = 'adodb-test'; |
$user = ' | $user = ' | ||
$password = ' | $password = ' | ||
$conn = ADOnewConnection(' | $conn = ADOnewConnection(' | ||
- | $conn-> | + | $conn-> |
</ | </ | ||
Line 57: | Line 67: | ||
<code php> | <code php> | ||
include ' | include ' | ||
- | $dsn = ' | + | $dsn = ' |
$conn = ADOnewConnection(' | $conn = ADOnewConnection(' | ||
$conn-> | $conn-> | ||
+ | </ | ||
+ | |||
+ | ------------------------------ | ||
+ | ===== Connection Example Using *LOCAL ===== | ||
+ | <code php> | ||
+ | include ' | ||
+ | $dsn = ' | ||
+ | $conn = ADOnewConnection(' | ||
+ | $conn-> | ||
+ | |||
+ | /* | ||
+ | * Add another connection | ||
+ | */ | ||
+ | $dsn = ' | ||
+ | $conn2 = ADOnewConnection(' | ||
+ | $conn2-> | ||
+ | ------------------------------ | ||
</ | </ | ||
v5/database/ibm_db2.1578915465.txt.gz · Last modified: 2020/01/13 12:37 by dregad