Bug #9065 Updated: Openlink4 connections worthless under Redhat
| From: | kalowsky@php.net | Date: | Tue, 08 May 2001 01:31:39 +0000 |
| Subject: | Bug #9065 Updated: Openlink4 connections worthless under Redhat | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-54326@lists.php.net to get a copy of this message | ||
ID: 9065
Updated by: kalowsky
Reported By: antiphobo@paradise.net.nz
Old-Status: Open
Status: Feedback
Bug Type: ODBC related
Operating system:
PHP Version: 4.0.3pl1
Assigned To:
Comments:
A) simpliest form for each test script please
B) still happen under PHP 4.0.5? There might be a need to
tweak the php_odbc.h file (remove the #include <iodbc.h> line).
Previous Comments:
---------------------------------------------------------------------------
[2001-02-02 01:14:18] antiphobo@paradise.net.nz
Here is the script I used to test all connections with. Ensure php.ini is setup so that errors are
passed back to $php_errormsg;
----------
<HTML>
<HEADER><TITLE>ODBCTEST</TITLE></HEADER>
<BODY BGCOLOR=EEEEEE TEXT=BLACK>
<FONT FACE=Tahoma>
<FONT COLOR=0099FF><B>ODBCTEST. By Sigurd Magnusson. </B></FONT>
<FONT COLOR=555555 SIZE=-2><B>(PHP <? echo phpversion()," on
$SERVER_SOFTWARE)" ?></B></FONT>
<P>
<FORM ACTION=odbctest.php METHOD=POST>
DSN: <INPUT TYPE=TEXT NAME=odbc_dsn VALUE="<? echo $odbc_dsn ?>">
Username: <INPUT TYPE=TEXT NAME=odbc_username VALUE="<? echo $odbc_username
?>">
Password: <INPUT TYPE=TEXT NAME=odbc_password VALUE="<? echo $odbc_password
?>">
Table: <INPUT TYPE=TEXT NAME=odbc_tablename VALUE="<? echo $odbc_tablename
?>">
<INPUT TYPE=SUBMIT VALUE=Test>
<DIV ALIGN=RIGHT>(If no table is specified, odbctest will search for them).</DIV>
</FORM>
<HR>
<?
if ($odbc_dsn == "") die("<B>No DSN specified</B>");
Echo "<OL>";
Echo "<LI><B>Connecting...</B><BR>odbc_connect($odbc_dsn,
$odbc_username, $odbc_password); "; flush;
$connect = @odbc_connect($odbc_dsn, $odbc_username, $odbc_password, SQL_CUR_USE_ODBC);
if ($connect) echo "<B>connected.</B><P>"; else ExitDying ("Connect
Failed", $php_errormsg);
flush();
if ($odbc_tablename) QueryTable($odbc_tablename); else ShowTables();
odbc_close($connect);
echo "</OL><HR>";
echo "<FONT COLOR=0099FF><B>ODBC Test Finished!</B></FONT>";
return;
////////////////////////////////////////////////////////////////////////////////////
function QueryTable($tablename) {
////////////////////////////////////////////////////////////////////////////////////
global $connect;
$maxdisplayrows= 10;
$query ="SELECT * FROM $tablename";
Echo "<LI><B>Querying $tablename...</B><BR>odbc_exec($connect,
$query); ";
$result = @odbc_exec($connect, $query); // perform the query
if ($result) echo "<B>ok.</B><P>"; else ExitDying ("Query
Failed", $php_errormsg);
Echo "<LI><B>Retrieving Data...</B><BR>odbc_fetchrow($result); ";
// get column names
$NumODBCFields = (int)odbc_num_fields($result);
echo "<table cellpadding=5 bgcolor=BLACK><tr bgcolor=yellow>";
for ($i=1; $i <= $NumODBCFields; $i++) {
echo "<TD><FONT
SIZE=2><B>".odbc_field_name($result,$i)."</B><BR>".odbc_field_type($result,$i),
" ", odbc_field_len($result,$i), "</TD>";
}
echo "</tr>";
while(@odbc_fetch_row($result)) {
if ($rowcount++ < $maxdisplayrows) {
echo "<tr bgcolor=22BBFF>";
for ($i=1; $i <= $NumODBCFields; $i++) {
$txt = @odbc_result($result, $i);
echo "<TD><FONT SIZE=1>$txt</FONT></TD>";
}
echo "</tr>";
}
}
echo "</table>";
if ($rowcount > $maxdisplayrows) $msg = "(only first $maxdisplayrows shown above)";
// if search is narrowing the rows down, we need to tally that instead ;(
echo "<BR>Found <B>".(int)$rowcount." Rows</B> $msg,
<B>".odbc_num_fields($result)." Columns</B> in table
<B>$tablename</B>";
}
////////////////////////////////
function ShowTables() {
global $connect;
Echo "<LI><B>Finding Tables...</B><BR>odbc_exec($connect, $query);
"; flush();
$result = @odbc_tables($connect,"%");
if ($result) echo "<B>ok</B><P>"; else ExitDying("Table Searching
Not Permitted?", $php_errormsg);
flush();
// get column names
$NumODBCFields = (int)odbc_num_fields($result);
echo "<table cellpadding=5 bgcolor=BLACK><tr bgcolor=white>";
for ($i=1; $i <= $NumODBCFields; $i++) {
echo "<TD><FONT
SIZE=2><B>".odbc_field_name($result,$i)."</B><BR>".odbc_field_type($result,$i),
" ", odbc_field_len($result,$i), "</TD>";
}
echo "</tr>";
while(@odbc_fetch_row($result)) {
echo "<tr bgcolor=white>";
for ($i=1; $i <= $NumODBCFields; $i++) {
echo "<TD><FONT SIZE=1>".odbc_result($result, $i),
"</FONT></TD>";
}
echo "</tr>";
if (odbc_result($result, "TABLE_TYPE") == "TABLE") {
$querytablename = odbc_result($result, "TABLE_NAME");
echo "<TR bgcolor=white><TD COLSPAN=$NumODBCFields>";
QueryTable($querytablename);
echo "</TD></TR>";
$numtables++;
}
}
echo "</table>";
if (!$numtables) $numtables = "<B>no</B>";
echo "Found $numtables tables...";
}
////////////////////////////////////////////////////////////////////////////////////
function ExitDying ($msg, $errormsg) {
////////////////////////////////////////////////////////////////////////////////////
Echo "<P><TABLE BGCOLOR=BLACK CELLPADDING=12><TR><TD
BGCOLOR=WHITE>";
Echo "<FONT
COLOR=RED><B>$msg</B></FONT><TT><P>$errormsg</TT>";
Echo "</TD></TR><TABLE>";
exit;
}
---------------------------------------------------------------------------
[2001-02-02 01:12:08] antiphobo@paradise.net.nz
When I connect from Linux Redhat (COBALT RAQ2)
PHP403sp1/Apache1.3.12 to a database on Win2000 using Openlink version *4*:
(PHP './configure' '--with-openlink=/usr/local/openlink'
'--with-mysql' '--with-apache=../apache_1.3.12' '--enable-track-vars'
)
Openlink(Linux) -> AccessDB(Win2k): Connects to database, SQL queries fail with "Not
Capable" error (see below). Retreiving list of tables fails with odbc_tables(); (complains that
odbc_tables($con, "%"); doesn't have the correct number of parameters.
Openlink(Linux) -> MyODBC(W2K) -> MySQL(W2K)
Connects to database, SELECTs return columns, but not rows.
Retriving list of tables "fails" (as can only see columns, such as TableName, TableType,
but no data)
--
When I connect from Win2000 PHP403sp1/IIS5 to database on Win2000 using Openlink:
Openlink -> Access: Works okay, except cannot retrieve TYPE of field. (This is of little
concern.).
Openlink -> MyODBC -> MySQL: as above.
When doing not using Openlink at all and connecting directly to Access all on the same W2k Machine,
everything works perfectly.
Errors Under Linux:
SELECT * FROM TABLE produces: SQL error: [OpenLink][ODBC][Driver]Driver not capable, SQL state S1C00
in SQLExecDirect
I am using odbc_connect() and odbc_exec(). (not prepare() ). Have tested differenet cursor types
with odbc_connect; nothing helps.
Using ODBCTEST (the testing utility with Openlink software), everything works fine - i have access
to all tables, databases, can perform complex SELECT and other queries without any hassle.
Thus, this is a problem not specific to Access, because I can connect to Access from Win2000
PHP/Openlink
It is not really a problem with openlink, because ODBCTEST works fine.
Thus it means it is to do with the Openlink and PHP403sp1 cooperating (on redhat). I tried compiling
PHP404 with Openlink4, but it failed (possibly due to Apache1.3.17).
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=9065&edit=2