2
votes

I get ORA-12514:TNS:listener does not currently know of service requested in connect descriptor when running my application yet I can connect to the database via server explorer in visual studio. Where does the application look (when published) to get the information required to connect to the database? The connection string used by our application is correct.

3

3 Answers

3
votes

It can change as the following and it is working in my environment. Drive:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN

listener.ora

  1. Before

    LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) ) )

  2. After

    LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.50.90)(PORT = 1521)) ) )

tnsnames.ora

  1. Before

    LISTENER_ORCL = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

    ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )

  2. After

    LISTENER_ORCL = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.50.90)(PORT = 1521))

    ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.50.90)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )

After that, restart the OracleOraDb11g_home1TNSListener service and OracleServiceORCL service.

2
votes

look for tnsnames.ora

http://www.orafaq.com/wiki/Tnsnames.ora

and keep in mind service name vs. server name.

0
votes

I faced the same exception when using sqldeveloper client. This may happen if the tnsnames.ora is not present in your machine or sqldeveloper is not properly installed.

To resolve this error, change the connection type to advanced and provide the JDBC connection URL in the format "jdbc:oracle:thin:@hostname:port:sid" as shown in the image below

SQL developer new connection window