php and db2 
Author Message
 php and db2

Hello,
I installed ibm db2 7.1 personal edition on Redhat linux 6.2.After
configuration and creation of sample database, I compiled php 4 with ibm-db2
support. But when I try to acces the sample database, I get the following
error:

Warning: SQL error: , SQL state ?C  ose_8??? D  compose_ in SQLConnect in
/www/htdocs/johan/test1.php on line 3

Warning: Supplied argument is not a valid ODBC-Link resource in
/www/htdocs/johan/test1.php on line 9

The code of php script is:

<?
// connect
$connect = odbc_connect("sample", "db2inst1", "pass");

// query
$query = "SELECT * FROM staff";

// perform the query
$result = odbc_exec($connect, $query);

// fetch the data from the database
while(odbc_fetch_row($result)){
  $name = odbc_result($result, 1);
  $surname = odbc_result($result, 2);
  print("$name $surname\n");

Quote:
}

// close the connection
odbc_close($connect);
?>

Where can I choose the host - how the script know,on which host to logon?
How can I check, that db2 is running?

Thanks in advance,

Janez

--
----------



Sat, 23 Aug 2003 08:39:09 GMT
 php and db2


Quote:

>Hello,
>I installed ibm db2 7.1 personal edition on Redhat linux 6.2.After
>configuration and creation of sample database, I compiled php 4 with ibm-db2
>support. But when I try to acces the sample database, I get the following
>error:

>Warning: SQL error: , SQL state ?C  ose_8??? D  compose_ in SQLConnect in
>/www/htdocs/johan/test1.php on line 3

>Warning: Supplied argument is not a valid ODBC-Link resource in
>/www/htdocs/johan/test1.php on line 9

>The code of php script is:

><?
>// connect
>$connect = odbc_connect("sample", "db2inst1", "pass");

I don't know anything about PHP, but I have a sample script that calls
odbc_pconnect rather than odbc_connect.  That said, I think the most
likely cause of this problem is the DB2INSTANCE environment variable
not being available in your environment.  Try exporting it in the
shell where you start your webserver.  You can check all your
environment variables in PHP by calling phpinfo().  DB2INSTANCE *must*
be set to the userid of the instance (in this case, db2inst1).

Hope this helps.

WW
--
Susan Williams
Technical Lead, DB2 on Linux



Mon, 01 Sep 2003 04:13:13 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. PHP and DB2 - anyone done anything with PHP?

2. PHP and DB2 (performance)

3. Help with PHP and DB2

4. php and DB2

5. PHP and Db2

6. W2K / PHP / ODBC / AS400 / DB2 / Call RPG program?

7. inserting date or timestamp in db2 with php via ODBC

8. Call IBM DB2 stored procedure from PHP

9. problem : accessing DB2 on os/390 with PHP on Linux

10. DB2+PHP file upload

11. Problem with ODBC Connection to DB2 via PHP

12. Connect to DB2 (on WinNT) from Linux PHP :Total Newbie


 
Powered by phpBB® Forum Software