php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9065 Openlink4 connections worthless under Redhat
Submitted: 2001-02-02 01:12 UTC Modified: 2001-05-31 17:15 UTC
From: antiphobo at paradise dot net dot nz Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0.3pl1 OS: Redhat Linux (MIPS)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: antiphobo at paradise dot net dot nz
New email:
PHP Version: OS:

 

 [2001-02-02 01:12 UTC] antiphobo at paradise dot net dot 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).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-02 01:14 UTC] antiphobo at paradise dot net dot 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-05-07 21:31 UTC] kalowsky@php.net
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).
 [2001-05-31 17:15 UTC] kalowsky@php.net
no feedback from user.  considered fixed in current.  if this is untrue, please reopen the bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Sep 17 05:01:27 2024 UTC