Hi,
It seems that SQLcl doesn't handle the /instance_name in EZCONNECT ( doc: https://docs.oracle.com/en/database/oracle/oracle-database/12.2/netag/configuring-naming-methods.html )
SQLcl: Release 17.4.0 Production on Fri Jan 12 15:05:33 2018
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
15:05:38 SQL> connect scott/tiger@//localhost:1521/PDB1:DEDICATED/CDB1 USER = scott
URL = jdbc:oracle:oci8:@//localhost:1521/PDB1:DEDICATED/CDB1
Error Message = ORA-12541: TNS:no listener
USER = scott
URL = jdbc:oracle:thin:@//localhost:1521/PDB1:DEDICATED/CDB1
Error Message = Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
Warning: You are no longer connected to ORACLE.
But this is ok in sqlplus:
15:06:02 SQL>
15:06:05 SQL> host sqlplus scott/tiger@//localhost:1521/PDB1:DEDICATED/CDB1
SQL*Plus: Release 12.2.0.1.0 Production on Fri Jan 12 15:06:11 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Last Successful login time: Fri Jan 12 2018 15:04:02 EUROPE/ZURICH CET
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
This should be translated to:
(DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=PDB1)(INSTANCE_NAME=CDB1)(SERVER=DEDICATED))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))
Regards,
Franck.