473,396 Members | 2,111 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,396 software developers and data experts.

Back with the same DB2/PHP problem

After working well for most of a week, my application with the
mysterious php/db2 problem is now failing again. No one has worked on
the php code this week.

We're running DB2 8.1.5, php 4.3.6 with db2 and apache options, Apache
and Linux.

We've been working on the database itself, recreating it several times
from its original sequential files to incorporate both new data and some
obscure structural changes. During this entire time we received no error
messages or application failures. This morning it began to fail
regularly. I tried rebooting the server, rebuilding the database,
looking for orphan sql processes/applications with list applications,
looked for orphan db2 tasks with ps -fe. All showed nothing. Found a few
orphans with:

db2 get snapshot for database on animals | grep oldest

and cleaned them up with:

db2 force application \(<number>\)

It did not affect the problem. I an still getting:

Warning: odbc_connect(): SQL error: Ä–ÿ¿|궰—ÿ¿Û, SQL state
ýÿÿÿ”_&ýÿÿÿÜ^&\_&ýÿÿÿøšÿ¿K/·D›ÿ¿ in SQLConnect in
/var/www/html/GEM/db.php on line 32

Added by my routine:

The odbc_connect parameters were:[animals] [xxxxxxxx] [xxxxxxxx]

[ýÿÿÿ”_][strlen(ýÿÿÿ”_)]

Error number ýÿÿÿ”_=X'fdffffff945f';
[Ä–ÿ¿|궰—ÿ¿Û][strlen(Ä–ÿ¿|궰—ÿ¿Û)]

Error message Ä–ÿ¿|궰—ÿ¿Û=X'c496ffbf7cea1cb6b097ffbfdb03';
could not connect to animals

The routine and its support routines are below:

<?php
// vim: set ts=4 sw=4 ai:
function hex($s) {
if($s=='') { return ''; }
echo "<br>[$s][strlen($s)]<br>";
$h = '';
for($i=0;$i<strlen($s);$i++) {
$t = dechex(ord($s[$i]));
if(strlen($t)==1) { $h .= '0'; }
$h .= $t;
}
return $h;
}

function showerror() {
$t = odbc_error();
echo "<br>Error number ".$t."=X'".hex($t)."';";
$t = odbc_errormsg();
echo "<br>Error message ".$t."=X'".hex($t)."';<br>";
}

function conn() {
global $schema, $database;
$schema = "is3";
$database = "animals";
$dbuser = "xxxxxxxx";
$dsn = "Driver=DB2;Server=localhost;Database=$databas e";
$dsn = $database;
$dbpwd = "xxxxxxx";
$dbConn = odbc_connect($dsn,$dbuser,$dbpwd);
if ( $dbConn==False) {
printf("<br>The odbc_connect parameters were:[%s] [%s] [%s]<br>\n",
$dsn,$dbuser,$dbpwd);
showerror();
odbc_close_all();
die("could not connect to $database");
}
return $dbConn;
}
?>

FWIW db2 seems to be functioning well, both locally and remotely.
Similarly php as long as I stay away from the db2 ODBC routines. Any
further suggestions would be greatly appreciated, I'm getting desperate.

Nov 12 '05 #1
2 2017
Hi Robert:

It looks like the newsgroup server dropped my post, so this is a really
late reply. But I replied earlier, honest!

1. Are you still using the same instance? For example, if you modified
/etc/init.d/httpd to include ". /home/db2inst1/sqllib/db2profile" but
your instance is now located under /home/instance/ you could run into
problems. It's also possible that a Red Hat update might have replaced
the /etc/init.d/httpd file, wiping out your change -- so it's worth
checking the file again :)

2. Can you connect to the [animals] database using the same user ID as
you are using in your PHP script? It's possible that someone might have
revoked the privileges for that user on the database tables. Try logging
on to the Linux box as the instance-owning user and connecting
directly from the command line to rule that out as a possibility.

3. Does /home/db2inst1/sqllib/db2profile (adjust for whatever instance
you're using) still exist and still have permissions that allow other
users to read the file? It's possible that an over-zealous sysadmin
tightened up the security for the user due to an audit without
understanding the implications of that action.

4. What does your php.ini file look like, specifically the ODBC section?
Are you using persistent connections?

5. Does your application issue odbc_disconnect()? It's possible that
your application is using up all of the available connections to the
database, which would certainly prevent you from being able to
connect--although list applications should show that.

Items 4 and 5 are more reflective of problems that you would see
developing over time, rather than seeing the problem immediately on
reboot. And since nobody touched the PHP code, it's unlikely that the
problem lies there, which leaves only the database and system
environment as the real suspects.

Robert Stearns wrote:
After working well for most of a week, my application with the
mysterious php/db2 problem is now failing again. No one has worked on
the php code this week.

We're running DB2 8.1.5, php 4.3.6 with db2 and apache options, Apache
and Linux.

We've been working on the database itself, recreating it several times
from its original sequential files to incorporate both new data and some
obscure structural changes. During this entire time we received no error
messages or application failures. This morning it began to fail
regularly. I tried rebooting the server, rebuilding the database,
looking for orphan sql processes/applications with list applications,
looked for orphan db2 tasks with ps -fe. All showed nothing. Found a few
orphans with:

db2 get snapshot for database on animals | grep oldest

and cleaned them up with:

db2 force application \(<number>\)

It did not affect the problem. I an still getting:

Warning: odbc_connect(): SQL error: Ä–ÿ¿|궰—ÿ¿Û, SQL state
ýÿÿÿ”_&ýÿÿÿÜ^&\_&ýÿÿÿøšÿ¿K/·D›ÿ¿ in SQLConnect in
/var/www/html/GEM/db.php on line 32

Added by my routine:

The odbc_connect parameters were:[animals] [xxxxxxxx] [xxxxxxxx]

[ýÿÿÿ”_][strlen(ýÿÿÿ”_)]

Error number ýÿÿÿ”_=X'fdffffff945f';
[Ä–ÿ¿|궰—ÿ¿Û][strlen(Ä–ÿ¿|궰—ÿ¿Û)]

Error message Ä–ÿ¿|궰—ÿ¿Û=X'c496ffbf7cea1cb6b097ffbfdb03';
could not connect to animals

The routine and its support routines are below:

<?php
// vim: set ts=4 sw=4 ai:
function hex($s) {
if($s=='') { return ''; }
echo "<br>[$s][strlen($s)]<br>";
$h = '';
for($i=0;$i<strlen($s);$i++) {
$t = dechex(ord($s[$i]));
if(strlen($t)==1) { $h .= '0'; }
$h .= $t;
}
return $h;
}

function showerror() {
$t = odbc_error();
echo "<br>Error number ".$t."=X'".hex($t)."';";
$t = odbc_errormsg();
echo "<br>Error message ".$t."=X'".hex($t)."';<br>";
}

function conn() {
global $schema, $database;
$schema = "is3";
$database = "animals";
$dbuser = "xxxxxxxx";
$dsn = "Driver=DB2;Server=localhost;Database=$databas e";
$dsn = $database;
$dbpwd = "xxxxxxx";
$dbConn = odbc_connect($dsn,$dbuser,$dbpwd);
if ( $dbConn==False) {
printf("<br>The odbc_connect parameters were:[%s] [%s] [%s]<br>\n",
$dsn,$dbuser,$dbpwd);
showerror();
odbc_close_all();
die("could not connect to $database");
}
return $dbConn;
}
?>

FWIW db2 seems to be functioning well, both locally and remotely.
Similarly php as long as I stay away from the db2 ODBC routines. Any
further suggestions would be greatly appreciated, I'm getting desperate.

Nov 12 '05 #2
Dan Scott wrote:
Hi Robert:

It looks like the newsgroup server dropped my post, so this is a really
late reply. But I replied earlier, honest!

1. Are you still using the same instance? For example, if you modified
/etc/init.d/httpd to include ". /home/db2inst1/sqllib/db2profile" but
your instance is now located under /home/instance/ you could run into
problems. It's also possible that a Red Hat update might have replaced
the /etc/init.d/httpd file, wiping out your change -- so it's worth
checking the file again :)

2. Can you connect to the [animals] database using the same user ID as
you are using in your PHP script? It's possible that someone might have
revoked the privileges for that user on the database tables. Try logging
on to the Linux box as the instance-owning user and connecting directly
from the command line to rule that out as a possibility.

3. Does /home/db2inst1/sqllib/db2profile (adjust for whatever instance
you're using) still exist and still have permissions that allow other
users to read the file? It's possible that an over-zealous sysadmin
tightened up the security for the user due to an audit without
understanding the implications of that action.

4. What does your php.ini file look like, specifically the ODBC section?
Are you using persistent connections?

5. Does your application issue odbc_disconnect()? It's possible that
your application is using up all of the available connections to the
database, which would certainly prevent you from being able to
connect--although list applications should show that.

Items 4 and 5 are more reflective of problems that you would see
developing over time, rather than seeing the problem immediately on
reboot. And since nobody touched the PHP code, it's unlikely that the
problem lies there, which leaves only the database and system
environment as the real suspects.

Robert Stearns wrote:
After working well for most of a week, my application with the
mysterious php/db2 problem is now failing again. No one has worked on
the php code this week.

We're running DB2 8.1.5, php 4.3.6 with db2 and apache options, Apache
and Linux.

We've been working on the database itself, recreating it several times
from its original sequential files to incorporate both new data and
some obscure structural changes. During this entire time we received
no error messages or application failures. This morning it began to
fail regularly. I tried rebooting the server, rebuilding the database,
looking for orphan sql processes/applications with list applications,
looked for orphan db2 tasks with ps -fe. All showed nothing. Found a
few orphans with:

db2 get snapshot for database on animals | grep oldest

and cleaned them up with:

db2 force application \(<number>\)

It did not affect the problem. I an still getting:

Warning: odbc_connect(): SQL error: Ä–ÿ¿|궰—ÿ¿Û, SQL state
ýÿÿÿ”_&ýÿÿÿÜ^&\_&ýÿÿÿøšÿ¿K/·D›ÿ¿ in SQLConnect in
/var/www/html/GEM/db.php on line 32

Added by my routine:

The odbc_connect parameters were:[animals] [xxxxxxxx] [xxxxxxxx]

[ýÿÿÿ”_][strlen(ýÿÿÿ”_)]

Error number ýÿÿÿ”_=X'fdffffff945f';
[Ä–ÿ¿|궰—ÿ¿Û][strlen(Ä–ÿ¿|궰—ÿ¿Û)]

Error message Ä–ÿ¿|궰—ÿ¿Û=X'c496ffbf7cea1cb6b097ffbfdb03';
could not connect to animals

The routine and its support routines are below:

<?php
// vim: set ts=4 sw=4 ai:
function hex($s) {
if($s=='') { return ''; }
echo "<br>[$s][strlen($s)]<br>";
$h = '';
for($i=0;$i<strlen($s);$i++) {
$t = dechex(ord($s[$i]));
if(strlen($t)==1) { $h .= '0'; }
$h .= $t;
}
return $h;
}

function showerror() {
$t = odbc_error();
echo "<br>Error number ".$t."=X'".hex($t)."';";
$t = odbc_errormsg();
echo "<br>Error message ".$t."=X'".hex($t)."';<br>";
}

function conn() {
global $schema, $database;
$schema = "is3";
$database = "animals";
$dbuser = "xxxxxxxx";
$dsn = "Driver=DB2;Server=localhost;Database=$databas e";
$dsn = $database;
$dbpwd = "xxxxxxx";
$dbConn = odbc_connect($dsn,$dbuser,$dbpwd);
if ( $dbConn==False) {
printf("<br>The odbc_connect parameters were:[%s] [%s]
[%s]<br>\n",
$dsn,$dbuser,$dbpwd);
showerror();
odbc_close_all();
die("could not connect to $database");
}
return $dbConn;
}
?>

FWIW db2 seems to be functioning well, both locally and remotely.
Similarly php as long as I stay away from the db2 ODBC routines. Any
further suggestions would be greatly appreciated, I'm getting desperate.


Sorry for following up on my own post, but for the archives the solution
turned out to be the ". /home/db2inst1/sqllib/db2profile" line had been
added to one of the Apache start-up scripts (apachectl, I believe), but
not to /etc/init.d/httpd -- which actually bypasses apachectl. Once
/etc/init.d/httpd had been updated to include that line, PHP was able to
connect to DB2 without problems.

Note that on Red Hat Enterprise Linux the safest place to put such a
line might be in a new file in the /etc/httpd/conf.d/ directory; e.g.
/etc/httpd/conf.d/db2.conf. In RHEL 3.0 /etc/init.d/httpd reads the
contents of all files in the /etc/httpd/conf.d/ directory, and you're
guaranteed not to run into a conflict if you have to update your Apache
(er, httpd) RPMs.

Dan
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lawrence | last post by:
I've been bad about documentation so far but I'm going to try to be better. I've mostly worked alone so I'm the only one, so far, who's suffered from my bad habits. But I'd like other programmers...
19
by: jameso321 | last post by:
Hi, We run an MS Access 2000 DB with about 15 users. It is on a Win 2000 Server (SP4) machine and runs through Citrix Metaframe Presentation Server 3.0. --------------------------
1
by: Peter D. Dunlap | last post by:
Hello, I realize that this may not be the best place to ask this question, through the application is asp.net. I also realize that questions about disabling the back button are generally met...
5
by: Brad | last post by:
I created a base page class which sets a response filter and the filter injects additional html into the response output stream. The filter works fine and everything works as expected except for...
3
by: Andre | last post by:
Hi, I have a page with 3 options, when a user select one, he's redirected to a page with several option (checkbox) each of them with autopostback set to true. My problem is : If the user...
1
by: Johan Nedin | last post by:
Hello! I am having a problem with the @OutputCache page directive and Web browser Back Buttons. Problem: After setting <%@ OutputCache Location="None" %> on my pages I get the "Warning!...
2
by: Tammy | last post by:
Hello - I have read many threads regarding back-end security and have found them all useful. I have a couple of (what seem to be basic) questions: I have a secured front-end and back-end...
4
by: Joseph Geretz | last post by:
We use a Soap Header to pass a token class (m_Token) back and forth with authenticated session information. Given the following implementation for our Logout method, I vastly prefer to simply code...
3
by: evenlater | last post by:
Using Access 2007, I've found that combo box back colors change to transparent from normal inconsistently for no reason I can discern. Never had that problem in previous versions of Access. I do...
8
by: Harvey Schmidlapp | last post by:
I have a fairly complex form (generated by means of an ASP 3 page). The form is used to define a query against a database. After running a query, the user hits their browser's back button and goes...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.