I am trying to connect to my Oracle database from SQLPlus, but I'm not able to connect.
I have Oracle client(10g) on my machine. Below are the details through which I am able to connect from my Java application.
connect('dbi:Oracle://IP/wborcle', 'username', 'pwd'));
What will be the hoststring when connecting via SQLPLUS?
Try
sqlplus username/password@host:port/service
sqlplus system/system@localhost:1521/xe
Copied from https://dba.stackexchange.com/questions/65032/connect-to-sql-plus-from-command-line-using-connection-string
Oracle offers several different methods for lookup up databases when you're trying to connect to them:
The most common approach is to put the databases you're connecting to into your tnsnames.ora
; usually, your client installation contains an example tnsnames.ora file that you can modify.
The easiest approach is probably to use EZConnect. An EZConnect string is built like
<username>/<password>@<hostname>:<port>/SID
so in your case, it (probably) will be something like
sqlplus scott/tiger@localhost:1521/wborcle
sqlplus user/pass@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=hostname.network)(Port=1521))(CONNECT_DATA=(SID=remote_SID)))
Maybe, and this might be dependant on the command line environment you're using, you need to quote the string, something like
sqlplus "user/pass@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=hostname.network)(Port=1521))(CONNECT_DATA=(SID=remote_SID)))"
or
sqlplus 'user/pass@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=hostname.network)(Port=1521))(CONNECT_DATA=(SID=remote_SID)))'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With