Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP and ODBC 1

Status
Not open for further replies.

ito74

Programmer
Joined
Sep 30, 2003
Messages
3
Location
ID
i have message error when try to use ODBC client access driver from PHP to connect as400 ... here is the message
"
Warning: odbc_connect(): SQL error: [IBM][Client Access ODBC Driver (32-bit)][DB2/400 SQL]Communication link failure. COMM RC=0x5, SQL state 08S01 in SQLConnect in c:\inetpub\ on line 4
Couldn't make a connection!
"
and here is php script
"
<?php
// create connection
$connection = odbc_connect
(&quot;ito200&quot;,&quot;EDP11&quot;,&quot;WOLVERINE&quot;);
// test connection
if (!$connection) {
echo &quot;Couldn't make a connection!&quot;;
exit;
}
// create SQL statement
$sql = &quot;SELECT * FROM TSEKSI&quot;;
// prepare SQL statement
$sql_result = odbc_exec($connection,$sql);
// format result in HTML table
odbc_result_all($sql_result,&quot;border=0&quot;);
// free resources and close connection
odbc_free_result($sql_result);
odbc_close($connection);
?>
&quot;
for information i use win xp with iis v5, PHP v4.3, as400 with os v3r2

any one can help

thx for hlp
 
i dont know much bout odbc but may i know to what database u r trying to connect?

Known is handfull, Unknown is worldfull
 
i try to use ODBC client access driver to get DB2/400 database from IBM as400 machine.
i usualy use this ODBC for others pc aplication like vb
and it's work find but in PHP i have that problem ... du no why?

thx for help bro
 
did u test ur ODBC in the control panel?

Known is handfull, Unknown is worldfull
 
yup ... and it's work.
 
why not use VB code? do u use ADO in VB? u can use the same in PHP...
try this:
Code:
<?
$con=new COM(&quot;ADODB.Connection&quot;);
$con->open &quot;ODBC FILE&quot;; //same like VB
?>



Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top