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 conne开发者_StackOverflow社区ct to the database? The connection string used by our application is correct.
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
Before
LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) ) )
After
LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.50.90)(PORT = 1521)) ) )
tnsnames.ora
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) ) )
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.
look for tnsnames.ora
http://www.orafaq.com/wiki/Tnsnames.ora
and keep in mind service name vs. server name.
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
精彩评论