Oracle EasyConnect connection string using SID?

I am trying to connect to an Oracle database through code (Ruby / DBI, but that doesn't matter) using the EasyConnect connection string. All Oracle documentation specifies the connection string as // hostname: port / service_name. I don’t have a server_name for the database I need to connect to, instead I have a SID. Is there a way to create an EasyConnect connection string using a SID instead of a service name?

My connection code is as follows:

DBI.connect("DBI:OCI8://localhost:9000/the_sid", "username here", "password here")

I keep trying different things, and depending on what I'm trying, I get one of two error messages:

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor (DBI::DatabaseError)
ORA-12154: TNS:could not resolve the connect identifier specified (DBI::DatabaseError)
+5
source share
1 answer

SID ? SID, . SERVICE_NAMES SID. SQL :

SQL> show parameter service

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      sid

SQL> 

() VALUE - (), .

+2

All Articles