priceline
priceline

Reputation: 3327

Unable to connect with SQLPlus, but it works with SQL Developer

Windows 7, Oracle 11.2.0.1; it used to be working fine, not sure what happened lately. But I am not able to connect to SQL plus using sqlplus, and entering user name and password.

SQL Developer is working fine. Also the following command is working fine:

sqlplus system/system@//localhost:1521/ORACUSTOM

Though the above command is working fine, some of the scripts are not working (as these scripts try to connect to a different database. So I need to make the following work:

$ sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Sat Nov 10 19:35:34 2012

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Enter user-name: system
Enter password:
ERROR:
ORA-12560: TNS:protocol adapter error

Enter user-name:

I'd appreciate if you can explain why one approach is working and the other is not.

Upvotes: 2

Views: 11917

Answers (1)

Sathyajith Bhat
Sathyajith Bhat

Reputation: 21851

The jdbc connection string

sqlplus system/system@//localhost:1521/ORACUSTOM

indicates that the service name 'ORACUSTOM' is used as the service name. Check the tnsnames.ora file for the right TNS name & ensure that it uses 'Oracustom' as the service name

In your case the TNS name should be something like

orcl =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(Host = localhost)(Port = 1521))
   )
 (CONNECT_DATA =
   (SERVICE_NAME = oracustom)
 )
)

With this entry in tnsnames.ora, you'll have to enter system@orcl as the username

(PS: Don't login as system. Bad idea.)

Upvotes: 1

Related Questions