[eluser]Unknown[/eluser]
My goal is to connect to both oracle and mysql. I have read only access on oracle and is a remote server. The mysql is local. The full message is:
Quote:Unable to connect to your database server using the provided settings.
Filename: C:\xampp\htdocs\odsupdate\system\database\DB_driver.php
Line Number: 124
I've looked on here but couldn't find an answer.
My database.php looks like this:
Code:
$db['oracle']['hostname'] = "(DESCRIPTION=
(ADDRESS =
(PROTOCOL = TCP)
(HOST = <myserver>)
(PORT = 1521)
)
CONNECT_DATA = (SID = PROD)
)";
$db['oracle']['username'] = 'username';
$db['oracle']['password'] = 'password';
$db['oracle']['database'] = '';
$db['oracle']['dbdriver'] = 'oci8';
$db['oracle']['dbprefix'] = '';
$db['oracle']['pconnect'] = TRUE;
$db['oracle']['db_debug'] = TRUE;
$db['oracle']['cache_on'] = FALSE;
$db['oracle']['cachedir'] = '';
$db['oracle']['char_set'] = 'utf8';
$db['oracle']['dbcollat'] = 'utf8_general_ci';
$db['oracle']['swap_pre'] = '';
$db['oracle']['autoinit'] = TRUE;
$db['oracle']['stricton'] = FALSE;
I get the error above. I connect with SQL_Developer and RazorSQL with no problem.
After first finding I needed to uncomment the php.ini line for php_oci8.dll, and copying that file into system32 dir, I tried connecting. Got the error above.
Then downloaded and unzipped instant_client, added a file TNSNAMES.ORA with the connection info in it.
I have Instant_client installed in c:\instant_client. Added it to PATH, and created a variable TNSNAMES and pointed to that directory.
Looking for the next thing to check, but can't find anything in the forum to check. Any help is greatly appreciated.
Thanks
Rick
UPDATE:
I am able to connect through php with the following in a view:
Quote: <?php
$myconnection = '(DESCRIPTION=(ADDRESS =(PROTOCOL = TCP)(HOST = <remote_server_name>)(PORT = 1521))(CONNECT_DATA = (SID = PROD)))';
if ($c = oci_connect('<username>', 'password', $myconnection)) {
echo "Successfully connected to Oracle.";
$query = "select * from mytable where update > '09-NOV-2011'";
echo "Query is set...<br>";
$result = oci_parse($c, $query);
echo "Running Query...<br>";
oci_execute($result);
echo "Query Returned...<br>";
while ($res = oci_fetch_array($result, OCI_ASSOC)) {
var_dump($res);
}
oci_close($c);
ALSO: I copied (from another post) the INSTANT CLIENT files into the c:\xampp\apache\bin directory. PATH and a TNS_ADMIN variables were set to include the c:\instant_client directory where the OCI dlls were.
Any help is appreciated.