Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / March 2004

Tip: Looking for answers? Try searching our database.

db2-php on linux

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robert Stearns - 17 Feb 2004 02:54 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.