Reputation: 573
oracle database is 12c,
I use java and write like url = jdbc:oracle:thin:@//192.168.203.10:1521/pdbcems
,
but get error
java.sql.SQLRecoverableException: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
My pdbs is like this,
SQL> select con_id,dbid,NAME,OPEN_MODE from v$pdbs;
CON_ID DBID NAME OPEN_MODE
2 510431291 PDB$SEED READ ONLY
3 1955806753 PDBORCL MOUNTED
4 2032327615 PDBCEMS MOUNTED
and lsnrctl is like this,
oracle@trace:~$ lsnrctl status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.203.10) (PORT=1521)))
STATUS of the LISTENER
------------------------
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.203.10)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=trace)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/orcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "orcl.localdomain.trace" has 1 instance(s).
Instance "yz", status READY, has 1 handler(s) for this service...
Service "orclXDB.localdomain.trace" has 1 instance(s).
Instance "yz", status READY, has 1 handler(s) for this service...
Service "pdbcems.localdomain.trace" has 1 instance(s).
Instance "yz", status READY, has 1 handler(s) for this service...
Service "pdborcl.localdomain.trace" has 1 instance(s).
Instance "yz", status READY, has 1 handler(s) for this service...
The command completed successfully
I cannot find the way solve this problem.
how to write the url
string.
Upvotes: 0
Views: 256
Reputation: 8357
Maybe service name you are making use of is not valid. Just to crosscheck this below query will give you list of services. Kindly make sure you are using correct service name.
select value from v$parameter where name='service_names';
Upvotes: 1