473,770 Members | 5,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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'fdffff ff945f';
[Ä–ÿ¿|궰—ÿ¿Û][strlen(Ä–ÿ¿|ê¶ °—ÿ¿Û)]

Error message Ä–ÿ¿|궰—ÿ¿Û= X'c496ffbf7cea1 cb6b097ffbfdb03 ';
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<str len($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;Ser ver=localhost;D atabase=$databa se";
$dsn = $database;
$dbpwd = "xxxxxxx";
$dbConn = odbc_connect($d sn,$dbuser,$dbp wd);
if ( $dbConn==False) {
printf("<br>The odbc_connect parameters were:[%s] [%s] [%s]<br>\n",
$dsn,$dbuser,$d bpwd);
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 2037
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'fdffff ff945f';
[Ä–ÿ¿|궰—ÿ¿Û][strlen(Ä–ÿ¿|ê¶ °—ÿ¿Û)]

Error message Ä–ÿ¿|궰—ÿ¿Û= X'c496ffbf7cea1 cb6b097ffbfdb03 ';
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<str len($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;Ser ver=localhost;D atabase=$databa se";
$dsn = $database;
$dbpwd = "xxxxxxx";
$dbConn = odbc_connect($d sn,$dbuser,$dbp wd);
if ( $dbConn==False) {
printf("<br>The odbc_connect parameters were:[%s] [%s] [%s]<br>\n",
$dsn,$dbuser,$d bpwd);
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'fdffff ff945f';
[Ä–ÿ¿|궰—ÿ¿Û][strlen(Ä–ÿ¿|ê¶ °—ÿ¿Û)]

Error message Ä–ÿ¿|궰—ÿ¿Û= X'c496ffbf7cea1 cb6b097ffbfdb03 ';
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<str len($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;Ser ver=localhost;D atabase=$databa se";
$dsn = $database;
$dbpwd = "xxxxxxx";
$dbConn = odbc_connect($d sn,$dbuser,$dbp wd);
if ( $dbConn==False) {
printf("<br>The odbc_connect parameters were:[%s] [%s]
[%s]<br>\n",
$dsn,$dbuser,$d bpwd);
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
3056
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 to have an easier time understanding what I do. Therefore this weekend I'm going to spend 3 days just writing comments. Before I do it, I thought I'd ask other programmers what information they find useful. Below is a typical class I've...
19
2718
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
4286
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 with derision, so let me explain: (1) The site is actually a web-based application, not a "web site" per say, and is not accessable by the public. It is an application used internally by the company I work for, though it accessed by employees
5
1740
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 the following quirk: When I navigate my browser to another url (a link in the page, a browser favorite...it doesn't mater) and then use the browsers (IE 6) Back or Forward buttons to go back to my filtered page the additional html I had added...
3
1777
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 click on the back button to go back to the page with the 3 main option, the browser only go back to the previous Postback, so if the
1
6432
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! Page has expired" error message, when pushing the Back Button in my Web browser.
2
1597
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 database. (I did use the security wizard for this.) By using the shortcuts provided, both files require a password to get in. Here is the problem: if I try to access the front-end through Windows
4
2486
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 m_Token = null in order to destroy the session token when the user logs out. However, I'm finding that setting class instance to null results in no header being sent back to the client, with the result that the client actually remains with an...
3
3006
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 have the back style properties set to Normal and back colors set to white, but sometimes when I tab out of a particular combo box the back color changes to match the back color of the detail section. Has anybody else had this experience? Is there...
8
4747
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 back to the form, where their selections show up. They can change whatever they want to change and resubmit the new query. Mostly, everything works fine, with radio buttons, selection lists, check boxes all coming back in the state they were in...
0
10058
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9870
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8886
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6678
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.