I'm trying to use ibm_db2 extension to access iSeries DB2 database.
This is the testcode (taken from here)
<?php
$database = 'ALI452BFAL'; //library
$user = 'STN452';
$password = '**********';
$hostname = 'myserverip';
$port = 50000;
$conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;" .
"HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;";
$conn = db2_connect($conn_string, '', '');
if ($conn) {
print "ok";
db2_close($conn);
}
else {
echo db2_conn_error() . '<br>' . db2_conn_errormsg();
}
?>
I have installed a very basic package containing the db2 driver and added this as an extension.
(IBM Data Server Driver for ODBC, CLI, and .NET.msi)
This is my result:
08001 [IBM][CLI Driver] SQL30081N A communication error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". Location where the error was detected: "10.10.0.120". Communication function detecting the error: "connect". Protocol specific error code(s): "10061", "", "". SQLSTATE=08001 SQLCODE=-30081
Anybody tried this before??
The port number you are using is incorrect – iSeries servers use port 446, not port 50000.
However, in order to use the IBM Data Server Driver for ODBC, CLI and .Net to access your iSeries server, you must have a license for the IBM product called DB2 Connect.
You do not need to use DB2 Connect, you can use the IBM i Access for Windows product, which provides an ODBC driver to connect directly to your iSeries server.