Hello all. Right now I'm trying to set up a web site that will connect to an Oracle database via ODBC, query it and display the results on the web. I have lots of experience using php with mySQL and even a little experience using ODBC to connect to an MS Access DB.
I've set up the Oracle tables (correctly as far as I can tell) and have an existing script to connect to the DB. I've installed Oracle 8i client on the server as well as set up an Oracle ODBC System datasource. The code looks like this:
<?
//Login Information
$dsn = "DSN Name"; //the dsn under System DSN tab
$dbuname = "Username"; //the username to connect
$dbpwd = "Password"; //and the password
//the built in odbc function to connect returns 0 (FALSE)
$connection = odbc_connect($dsn,$dbuname,$dbpwd);
//Query Database and display all results as a table.
$query = "SELECT * FROM TABLE_NAME";
$result = odbc_Exec($conn,$query);
$display = odbc_result_all($result);
//Disconnect from database
odbc_close($connection);
?>
<body>
<? echo "$display"; ?>
</body>
When I run this on the web I get the following error:
Warning: Supplied argument is not a valid ODBC-Link resource in C:\Inetpub\wwwroot\Site_License\oracle_test_connect.php on line 12
Warning: Supplied argument is not a valid ODBC result resource in C:\Inetpub\wwwroot\Site_License\oracle_test_connect.php on line 13
Originally when I started this project I was going to use the built in PHP functions and extensions to do this task. For some odd reason I can get it to load the php_oracle.dll extension but not the php_oci8.dll extension.
Any insights that anyone could give me on this issue would be greatly appreciated.
Thanks,
Nick