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.