473,385 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

DB2 PHP connection issue

I am trying to connect to our DB2 DB with PHP using ADOdb. Below is my environment.

Windows XP
PHP 5.2.5
DB2 Run-Time Client 8.2
IIS

I connect with the following code:
[PHP]
include('adodb/adodb.inc.php');
$db = ADONewConnection('db2');

$dsn = "driver={IBM db2 odbc DRIVER};Database=$DBName;hostname=$Host;port=$Port ;protocol=TCPIP;uid=$User;pwd=$Password";
if ($db->Connect($dsn)) {
echo "It worked";
} else {
echo "***didn't work db->Connect(dsn)<br>";
echo 'SQLSTATE: '.$db->ErrorNo()."<br>";
echo 'Message: '.$db->ErrorMsg()."<br><br>";
}
[/PHP]

I get the following error:
Expand|Select|Wrap|Line Numbers
  1. ***didn't work db->Connect(dsn)
  2. SQLSTATE: 42968
  3. Message: [IBM][CLI Driver] SQL8002N Connect processing failed; a valid product license was not found. SQLSTATE=42968 SQLCODE=-8002
  4.  
I know I am using the correct iSeries port, the correct DB name, and a fully licensed server. Has anyone ever seen this error?
Nov 13 '08 #1
2 4030
r035198x
13,262 8TB
Are you able to connect to the database from the command line?
If you installed your license key correctly then you might need to contact your IBM representative.
Nov 14 '08 #2
I GOT IT!

You need to install iSeries Client Access on your PHP server to get the correct drivers you need. I did a custom install and selected to install the Required Programs and Data Access including Data Transfer, ODBC, and OLE DB Provider.

Then I connected as below.
[PHP]
include('adodb/adodb.inc.php');
$db = ADONewConnection('odbc');
$dsn = "DRIVER={iSeries Access ODBC Driver};SYSTEM=$Host;DATABASE=$DBName;PROTOCOL=TCP IP;PORT=$Port;";
if ($db->Connect($dsn,$User,$Password)){
echo "It worked";
$sql = "SELECT table_name, table_type, table_schema, system_table_name FROM qsys2.systables";
$rs = $db->Execute($sql);
if (!$rs) echo "<p>no records</p>";
else {
$result = $rs->GetArray();
echo "<pre>";
print_r($result);
echo "</pre>";
}
} else {
echo "Not working";
echo 'SQLSTATE: '.$db->ErrorNo()."<br>";
echo 'Message: '.$db->ErrorMsg()."<br><br>";
}
[/PHP]
Nov 14 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ryan Schefke | last post by:
------=_NextPart_000_0077_01C34C8B.2B90C960 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ..I just sent this out to the win32 distribution list but no one has...
5
by: Brian Piotrowski | last post by:
Hi All, I almost have the connection working for my connection to the AS/400 from an ASP page. However, I have an error appearing, and I'm not sure how to fix it. The code I have for...
0
by: Rig76 | last post by:
I'm having a very strange issue with an application I'm building. The applicaiton has multiple users, each with their own connection to the database. However, when one of these connections closes...
0
by: WC Justice | last post by:
This website is running on IIS 6, SQL Server 7 back end, asp scripting. It has public and private areas, but uses the same connection scripting throughout the entire site. SET conn =...
7
by: Mike | last post by:
I'm trying to connect to a SQL 2000 db that is on another server then the web server. I setup and ID and PWD to access the SQL db via the code and it works locally and when I put the everything...
2
by: JohnnyBoy | last post by:
I am learning to program C++ .net and am having difficulty with one of the exercises and wondered if someone could help? I am including the code for a console app I wrote according to the exercise...
1
by: OldButStillLearning | last post by:
OK, I am trying to connect to DB2 (z/OS). I have successfully made the connection to the database in the Server Explorer. I am also able to successfully log in to DB2 when I am testing the...
3
by: JD | last post by:
Hello, I am dealing with an issue, that although probably simple, is driving me crazy. I am trying to connect to a SQL 2005 Express database through a web service using the following code: ...
1
by: nickyeng | last post by:
Hi all, I have a question. The situation is like this. I have website and allow user to login and check their details. Every pages are jsp file and contented connection to mysql database to...
2
by: Martin | last post by:
I have the following code being used in several of my PHP scripts (it's in an include file). It opens a socket connection to a process that's running on the same computer that IIS/PHP is running...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.