Hello,
I'm trying to connect to a remote Oracle server. I'm using PHP 5.1.6 and APACHE 2.2.3.
I have all the Oracle details I need, I have the server host, server name, user/pass and port.
How can I connect to it and start firing off queries?
I looked in some of the existing function (ora_logon,OCILogon, oci_connect) but it appears that none of them is accepting my connection details as parameters.
Thanks.
connect to a remote Oracle DB
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
The first note on oci_connect()'s page would suggest some form of DSN. On the older oracle pages, remote connections were added to some configuration file.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Does anyone have an example on the connection string to a remote ORACLE database?? I've been trying to look for one, and an easy to follow tutorial but I just can't seem to find one. If anyone knows, could you please post it here? This are my DB details....
HOST: my.servername.com
PORT: 1234
SID: engr
Thanks!
HOST: my.servername.com
PORT: 1234
SID: engr
Thanks!
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
http://www.connectionstrings.com/
There is an Oracle section in their. You might also want to search Oracle's web site as they are continually adding information about Oracle and PHP.
There is an Oracle section in their. You might also want to search Oracle's web site as they are continually adding information about Oracle and PHP.
OK, after doing a lot of research I found that I had to do the following:
I had to uncomment the OCI8 extension in PHP.INI:
I download the Instant Client Basic package for Windows from the Oracle site.
I created a subdirectory (e.g., c:\instantclient10_2) and copy these libraries from the zip file:
This is a sample from my PHP.INI file(I am using XAMPP so the location for this file is: C:\xampp\xampp\apache\bin I had a lot of problems editing the wrong PHP.INI file
) for the extension path:
Make sure it is correct and corresponds to where you have PHP installed.
NOTE: I am using XAMPP 1.5.5 and Windows 2000, there are instructions on the Oracle website to configure php and oracle on Linux.
I did all of that (which was in the oracle site http://www.oracle.com/technology/pub/no ... stant.html) and if you run PHPINFO() there HAS TO BE an OCI8 Section in that page if it is not, then you did something wrong.
Now here is an example of the connection string to oracle:
Now the OCILogon instruction gets recognized, but I have just one more problem, my Oracle database is in another server, and when I run the above code I get the following warning:
I had to uncomment the OCI8 extension in PHP.INI:
Code: Select all
extension=php_oci8.dllI download the Instant Client Basic package for Windows from the Oracle site.
I created a subdirectory (e.g., c:\instantclient10_2) and copy these libraries from the zip file:
- * oraociei10.dll
* orannzsbb10.dll
* oci.dll
This is a sample from my PHP.INI file(I am using XAMPP so the location for this file is: C:\xampp\xampp\apache\bin I had a lot of problems editing the wrong PHP.INI file
Code: Select all
; Directory in which the loadable extensions (modules) reside.
extension_dir = "C:\xampp\xampp\php\ext\"NOTE: I am using XAMPP 1.5.5 and Windows 2000, there are instructions on the Oracle website to configure php and oracle on Linux.
I did all of that (which was in the oracle site http://www.oracle.com/technology/pub/no ... stant.html) and if you run PHPINFO() there HAS TO BE an OCI8 Section in that page if it is not, then you did something wrong.
Now here is an example of the connection string to oracle:
Code: Select all
$conn = OCILogon("USER_NAME", "PASSWORD","//oracle_server.domain:1521/DB_NAME");Does anyone knows how to fix this???Warning: ocilogon() [function.ocilogon]: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor in C:\xampp\xampp\htdocs\test\test.php on line 2