I get the following output from a very simple page which tries to
connect to a db2 database hosted on my linux system, which is also
hosting my apache/php system. I have tried several permutations of the
connect string:
"animals"
"odbc://localhost/animals"
"dbc:/user@keyword/localhost/animals"
all with the same result. the php page is appended after the error
message. The book is singularly uninformative about this message and its
possible causes in this environment. If you have any ideas or pointers
to further information, I would greatly appreciate it.
---------------message/screen shot--------------------------------------
animals
Warning: odbc_connect(): SQL error: [IBM][CLI Driver] CLI0126E Operation
invalid at this time. SQLSTATE=S1011, SQL state S1011 in
SQLSetConnectOption in /var/www/html/test/second.php on line 15
fail
---------------php code-------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd" >
<html>
<head>
<title>First Database Try</title>
</head>
<body bgcolor="#ffffff">
<h1>
<?php
putenv("DB2INSTANCE=db2inst1");
// $cs = "odbc:/uu:pw/localhost/animals";
$cs = "animals";
echo "$cs";
// $res = odbc_connect($cs,"uu","pw");
$res =
odbc_connect($cs,"uu","pw",SQL_CUR_USE_ODBC);
if ( $res===False) {
echo "fail";
}
else {
echo "succeed";
}
?>
</h1>
</body>
</html>
~
Helmut Tessarek - 17 Feb 2004 13:58 GMT
Hi Robert,
> I get the following output from a very simple page which tries to connect to a db2 database hosted on my linux system, which is also hosting my apache/php system. I have tried several permutations of the connect string:
> "animals"
> "odbc://localhost/animals"
> "dbc:/user@keyword/localhost/animals"
$dbname = "animals";
$dbuser = "userid";
$dbpwd = "password";
$conn = odbc_pconnect( $dbname, $dbuser, $dbpwd );
This should do it. It seems that the environment is not set correctly. Have you added
. /home/db2inst1/sqllib/db2profile
to the apachectl file?
You can find an article on how to set up Apache with SSL, PHP and DB2 on the following site
http://www.evermeet.cx/db2issues/show.php?ts=2003-10-21%2022:28:46.276772
A pdf doc is available there aswell.

Signature
Helmut K. C. Tessarek
Rick Hickerson - 03 Mar 2004 18:41 GMT
I was having connection trouble on Mandrake 9.2. PHP could connect only
intermittently.
Adding:
. /home/db2inst1/sqllib/db2profile
to /etc/rc.d/init.d/httpd and restarting the httpd fixed the problem. Thus, the
standard Mandrake 9.2 distribution worked after I made the changes mentioned in
my post to this group on 2004-02-13 and this change to the httpd script.
Rick
> Hi Robert,
>
[quoted text clipped - 23 lines]
>
> A pdf doc is available there aswell.