Search code examples
phporacle-databaseoracle-call-interface

how to get access to a distant oracle server


I have never worked on an oracle database, however, now I need to use php (executed on a different server) to log into the oracle database, but it seems that there is some missing data.

what I have:

  • Ip address of the server and the port 1521 (ping OK from the server running my php)
  • data base's name
  • user with all privileges
  • the server is perfectly working (another application that is totally relying on the oracle server is perfectly working)

what I don't have:

  • Service Name
  • The used Oracle version (more likely 11g but not sure)
  • any kind of access to the server's system

I tried some guessed service names but I get:

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

I tried some other alternatives such using SID but still the same error with SID this time instead of service:

ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

All the other solutions I found require an access to the server to run some scripts or commands, but this is impossible for my case.

The code I use :

$user = 'myUser';
$password = 'myPassword';
$database = 'MY_DB'; 
$conn=oci_connect($user,$password,
'(DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.l.l00)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = someName)
    )
  )');

if ($conn) {
   echo "connected";
}
else
{
    echo "not connected";
}

with the error message followed by "not connected" as a result on my browser. So, is it possible to somehow log into the database? or is it impossible?


Solution

  • the DBA gave me the missing information