I can connect to a remote database using SQLDeveloper.
I am trying to connect to the same database using sqlcl from the command line, but I am getting an error.
It looks like your SID and service name are not the same. In SQL Developer you seem to be using the SID - at least in the custom JDBC URL you showed - as denoted by the colon in :vdbsl4
.
Your SQLcl URL is using the service name, as denoted by the slash in /vdbsl14
. Using the SID instead (i.e. changing the / to :) in that URL should work since it's using JDBC:
sqlcl username/pass@delphix-vdb-n-1.va2.b2c.nike.com:1521:vdbsl14
Alternatively (and preferably, in my opinion) find out what your service name actually is. If you have sufficient privileges on the database you can do show parameters service_names
from SQL Devleoper, or if you have access to the server as DBA you can do lsnrctl services
, or even look at the tnsnames.ora
in case there is a TNS alias defined that shows the service name. (listener.ora
isn't likely to help, but could give hints or if you're lucky show a default service name).
You can use that service name in a JDBC URL, as /service_name
.
You can also use a TNS alias from SQLcl (or SQL*Plus). You may already have a tnsnames.ora
available; if not you might be able to copy it from your server, or create your own. That can refer to the SID or the service name.
You can even pass a full TNS description to SQL*Plus (not sure about SQLcl) but that's a bit unpleasant. If you don't have/want a tnsnames.ora
you can use 'easy connect' syntax, which is the same as you're using for SQLcl - but that has to be the service name, it doesn't allow SIDs.