So far I have always received connection details for oracle databases providing me with the SID, which gives you the name of a database.

Using an SID in the SQL Developer configuration is working fine, but using the same configuration using the SID name in a JDBC oracle connection String as a service name will not work.

At first attempt I many times came across the following sql exception (below a link to a short explanation on

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

Every time this happened I had to either adjust an oracle specific file called tnsames.ora, which contains configuration details for services registered with an oracle database or change the connection String to use the actual service name instead of the SID.

Adjust tnsnames.ora

The file tnsnames.ora is located under in the following directory.


tnsnames.ora looks something like this.

ServiceName =
      (ADDRESS = (PROTOCOL = TCP)(HOST = *valid host*)(PORT = *valid port*))
      (SERVICE_NAME = *valid service name*)

The SERVICE_NAME has to exactly match a service name registered in your database. In order to get a list of valid service names use the following query. 

select value from v$parameter where name='service_names'

The connection String then has to reference the service using the name entered as ServiceName in a tnsnames.ora file. Below the syntax for a jdbc oracle connection String. I am using a Properties object to read the information from a properties file.

conn = DriverManager.getConnection("jdbc:oracle:thin:@//" + props.getProperty(PROP_HOST) + ":" + props.getProperty(PROP_PORT) + "/" + props.getProperty(PROP_SERVICE),props.getProperty(PROP_USER), pass);

Checking the actual names / connection parameters using SQL

If this does not work, another possible root cause for the error described above might be simply that someone has provided you with invalid names for SID and / or host.

This solution requires that you already have established a database connection to the db in question, but at least you will be able to provide someone with SQL statements who could run it for you.

/* Provides the SID. */
select sys_context('userenv','instance_name') from dual;
/* Provides the host. */
select sys_context('userenv', 'server_host') from dual;