Reputation: 2784
I'm using CentOS release 5.6 (Final) with PHP 5.1.6 (cli) (built: Feb 2 2012 18:24:47). I need to connect with a DB2 database server in same local network. Db2 version is V5R3. I have installed iSeriesAccess client as well as unixODBC.
My odbc.ini configuration:
[iSeries Access ODBC Driver]
Description = iSeries Access for Linux ODBC Driver
Driver = /opt/ibm/iSeriesAccess/lib/libcwbodbc.so
Setup = /opt/ibm/iSeriesAccess/lib/libcwbodbcs.so
NOTE1 = If using unixODBC 2.2.11 or later and you want the 32 and 64-bit ODBC drivers to share DSN's,
NOTE2 = the following Driver64/Setup64 keywords will provide that support.
Driver64 = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
Setup64 = /opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
Threading = 2
DontDLClose = 1
UsageCount = 1
i'm running the following code:
<?php
$database = 'dbname';
$server = 'local_ip';
$user = 'username';
$password = 'password';
$driver = 'iSeries Access ODBC Driver';
$conn = odbc_connect("Driver={iSeries Access ODBC Driver};Server=$server;Database=$database;", $user, $password);
if (!$conn......)
I'm getting the following error message: "[unixODBC][IBM][System i Access ODBC Driver]Missing system name needed for connection.Error!"
Is there anything I'm missing? your suggestions are welcome.
Upvotes: 1
Views: 9901
Reputation: 36
Can try with a working odbc.ini configuration
[DB2]
Description = ODBC for DB2
Driver = /opt/ibm/iSeriesAccess/lib/libcwbodbc.so
Setup = /opt/ibm/iSeriesAccess/lib/libcwbodbcs.so
FileUsage = 1
Threading = 2
DontDLClose = 1
UsageCount = 1
[mydb]
Driver = DB2
SYSTEM = 172.16.10.1
USER = username
PASSWORD = userpass
PORT = 50000
DATABASE = db11
Option = 1
Upvotes: 2
Reputation: 41168
The Server
property should be System
.
More information can be found in the i5/OS Information Center for Connection string keywords and General properties.
Upvotes: 5
Reputation: 1
Check this thread: http://www.jitterbit.com/PhpBB/viewtopic.php?f=4&t=87
"Although this thread is a bit dated, I did get my AS/400 connection working. I had to use the "DSN" option and manually build the connection string."
Upvotes: 0