If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > PHP ODBC_Connect to DB2 problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-24-04, 09:12
tnugent tnugent is offline
Registered User
 
Join Date: Nov 2002
Posts: 2
PHP ODBC_Connect to DB2 problem

Hi

We have a problem using the PHP unified ODBC function odbc_connect() to access a remote database :

We have a server running a DB2 UDB database for Linux

We are attempting to access this database from an application server that is running PHP and Apache on Linux. On this server we have installed DB2 Connect and the DB2 Application Development Client.

On the application server we have catalogued the remote database as follows:

Database Directory

Database alias = WEBPRD01
Database name = WEBPRD01
Node name = MYBBB01
Database release level = 9.00
Directory entry type = Remote
Catalog node number = -1

Node Directory

Node Name = MYBBB01
Protocol = TCPIP
Hostname = mybbb01.mybbb.co.uk
Service Name = 3700

From the command line we are able to connect to the database server successfully and issue an SQL select statement.

However, when we try to access the remote database server via the following PHP script we get the following error:

Warning: odbc_connect(): SQL error:, SQL State $ in SQl Connect

PHP Script

<?php

$dsn = "WEBPRD01";
$user = "******";
$password = "*******";

$conn = odbc_connect($dsn,$user,$password);
?>

We have compiled PHP with the appropriate "--with-ibm-db2=/home/db2inst1/sqllib" configuration parameter.

It seems as though the problem revolves around the PHP unified ODBC function odbc_connect() and its ability to connect to a remote database.
Could anybody give us any clues as to what might be the problem ?

Many Thanks in advance for any help you can offer

Software Versions

Application Server

Linux: Red Hat 7.3
Apache: 1.3.29
PHP: 4.3.9
DB2 Connect : DB2 Connect Personal Edition 7.2

Database Server

Linux: Red Hat 7.3
DB2 : DB2 7.1 Fixpack 7 (DB2 v7.1.0.68)
Reply With Quote
  #2 (permalink)  
Old 11-25-04, 11:39
tnugent tnugent is offline
Registered User
 
Join Date: Nov 2002
Posts: 2
Smile Problem Resolved

We have resolved our own problem.

For the info of others, the problem was due to the fact that the user id the webserver was running as did not have access rights to the databases, despite the fact that we were using the correct user and password within the odbc_connect call in the PHP script.

Hope this helps others in the future !

Last edited by tnugent; 11-25-04 at 11:43.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On