1

I have this code :

ociinternaldebug(1);


// try connecting to the database
 $conn = oci_new_connect('username', 'password', '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.1 )(PORT = 1521)) (CONNECT_DATA = (SID = dpsid)))');

// check for any errors
 if (!$conn)
 {
  $e = oci_error();
  print htmlentities($e['message']);
  exit;
 } 

// else there weren't any errors
 else
 {
  echo 'connected.';
 } 

and I get this error :

    OCI8 DEBUG: OCINlsEnvironmentVariableGet at (ext\oci8\oci8.c:1758) OCI8 DEBUG: OCIEnvNlsCreate at (ext\oci8\oci8.c:2708) OCI8 DEBUG: OCIHandleAlloc at (ext\oci8\oci8.c:2568) OCI8 DEBUG: OCIHandleAlloc at (ext\oci8\oci8.c:2580) OCI8 DEBUG: OCISessionPoolCreate at (ext\oci8\oci8.c:2598) OCI8 DEBUG: OCIAttrSet at (ext\oci8\oci8.c:2610) OCI8 DEBUG L1: create_spool: (0x1dde4f0) at (ext\oci8\oci8.c:2626) OCI8 DEBUG L1: using shared pool: (0x1dde4f0) at (ext\oci8\oci8.c:2904) OCI8 DEBUG: OCIHandleAlloc at (ext\oci8\oci8.c:2915) OCI8 DEBUG: OCIHandleAlloc at (ext\oci8\oci8.c:2925) OCI8 DEBUG: OCIAttrGet at (ext\oci8\oci8.c:2958) OCI8 DEBUG: OCIAttrGet at (ext\oci8\oci8.c:2959) OCI8 DEBUG L1: (numopen=0)(numbusy=0) at (ext\oci8\oci8.c:2961) OCI8 DEBUG: OCISessionGet at (ext\oci8\oci8.c:2972) OCI8 DEBUG: OCIErrorGet at (ext\oci8\oci8.c:1571) 
Warning: oci_new_connect() [function.oci-new-connect]: ORA-12170: TNS:Connect timeout occurred in C:\wamp\www\view\test.php on line 21
OCI8 DEBUG: OCIHandleFree at (ext\oci8\oci8.c:2150) OCI8 DEBUG: OCIHandleFree at (ext\oci8\oci8.c:2153) OCI8 DEBUG: OCIErrorGet at (ext\oci8\oci8.c:1571) ORA-12170: TNS:Connect timeout occurred

I am trying to connect to Remote Oracle database but I am getting this error and I don't know why

what is the problem?

Stephan
  • 41,764
  • 65
  • 238
  • 329
Saleh
  • 2,657
  • 12
  • 46
  • 73

2 Answers2

2

The problem is obvious, sqlnet timeout. The cause is not always that obvious.

Start with checking the host connectivity: telnet 1.1.1.1 1521 If you get a blank screen and not an error message, your host connectivity is ok. If you get connection refused: your listener is not running, or at least, not on the specified port. if you don't get any response at all, check the firewall[s].

if this is ok, we can dig deeper.

  • where I can run this command telnet 1.1.1.1 1521, can you specify please? – Saleh Apr 18 '11 at 10:45
  • From the host where the php server is running. That host should be able to connect to the listener of the database server. –  Apr 18 '11 at 10:56
  • I am getting connection time out fail, and I used a program terminal emulator to connect – Saleh Apr 18 '11 at 11:30
  • so your problem is a host connection problem. I assume that the address you specified 1.1.1.1 is a fake one? check your ip addresses and net masks. contact your network specialist for more help. Normally when both servers have the same netmask, connectivity is ok, when it is not blocked by a firewall. –  Apr 18 '11 at 14:11
  • yes, the 1.1.1.1 is a fake and I want to tell you that I am connecting from my PC which installed on it Win 7 64Bit with oracle 10g express edition and WampServer for PHP and I have DSL connection for internet, what do you mean check your ip addresses and net masks, every thing is set to automatic setting for ip address and DNS config if this what do you mean – Saleh Apr 18 '11 at 21:27
  • see http://www.comptechdoc.org/os/linux/usersguide/linux_ugbasicnet.html and see http://homepage.ntlworld.com/robin.d.h.walker/cmtips/ipaddr.html –  Apr 19 '11 at 05:02
  • I checked these websites but can you tell me more why I am facing this problem or what should I change in my network setting because when I checked these websites all what I can find is how to get your ip or network information, how can this help me? and thank you for your help – Saleh Apr 19 '11 at 13:22
  • You could use that info to verify your own ip-address, that of the database server, the netmask, the default router. Are the interfaces up? You need those to know if you can make a connection at all. You need to provide the details. Without the details I can not help any further. Also, check the firewalls. Where is the database server located, on the internet? How did you get the address of the database server? –  Apr 19 '11 at 14:13
  • sorry for late, the real IP address that I am trying to connect is 91.144.1.28 with port 1521 and I have a username and a password, I got the information from a customer that need to create a custom website to get user data and display it, this IP for ISP server contains data for users subscribed in ISP, I tried to connect from many PCs and I got the same result "connection timed out", I don't know what is the problem, is it from me or the oracle server but as I told I tried many PCs and I checked network setting but I can't find any problem – Saleh Apr 20 '11 at 19:06
  • first, this has absolutely nothing to do with oracle. So the ip is supposed to be on the internet. In that case, try traceroute, of from windows tracert, with the ipaddress of the db server as argument. It will fail. As far as I can see, you can not pass 91.144.1.2 so there could be anything on that machine. Could be a firewall there. Who is the administrator of 91.144.1.2 and the other server? The admin can help you. –  Apr 20 '11 at 20:01
  • thank you, if I want to talk with the oracle admin, what is the best to tell him to describe this problem that I am facing? – Saleh Apr 20 '11 at 20:25
  • give the result list of the tracert. A network admin should be able to help you further. –  Apr 20 '11 at 20:28
0

Connect timeout suggests it cannot reach the destination (IP address) you've provided.

This could be because:

  • The server you're connecting to is restricted by a firewall
  • The IP address and/or port you're using is incorrect
  • The server itself is currently down.
Craig Sefton
  • 903
  • 11
  • 20