Exception in thread "main" java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:419)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:536)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:228)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at com.test.OracleTest.main(OracleTest.java:13)
Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:386)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1054)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)
... 7 more
//create a Connection object.
Connection conn = DriverManager getConnection (” JDBC: oracle: thin: @ localhost: 1521: former “, “admit”, “123”);
The problem is the database to monitor the sid in the configuration file is not correct, namely the “former” in the url, enter the database installation directory, find tnsnames. Ora file, for example, my path is/home/Oracle_11g/product/11.2.0/dbhome_1/network/admin/tnsnames. Ora
found SERVICE_NAME = XE, but not equal to the former, So you can change the url of the former to XE can
Connection conn = DriverManager. GetConnection (” JDBC: oracle: thin: @ localhost: 1521: former “, “admit”, “123”);
Read More:
- Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently
- [Solved] SpringBoot Integrating Oracle reports errors: ORA-12504, TNS:listener was not given the SID in CONNECT_DATA
- Failed to obtain JDBC Connection
- Analysis of JDBC connection to MySQL
- In the XML configuration file of spring jdbc.properties The connection to the database failed due to garbled code
- java.sql.SQLRecoverableException: IO Error: Connection reset
- Navicate premium Connecting to a remote Oracle,ORA-12514: TNS:listener does not currently know of service requested in c
- Initialization error of PLSQL connection to Oracle
- Deployment project error: Oracle 11g ora-12505, TNS:listener does not currently know of SID given in connect descriptor
- JDBC connect to Sql Server to connect to the database–The TCP/IP connection to the host localhost, port 1433 has failed
- java.lang.AbstractMethodError:com.mysql.jdbc.Connection.isValid(I)Z
- Vscode remote connection server reports an error: could not establish connection to “XXXXXX” [resolved]
- Connection error:Cannot connect to redis-server. Details are available in connection log.
- Synergy 1.4.12 “ipc connection error, connection refused” and other issues
- hdfs 192.168.2.19:9000 failed on connection exception: java.net.ConnectException:Connection refused
- failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
- Windows_ Win7 broadband connection prompt remote access connection manager error
- Oracle11gr2 database suddenly “TNS no listener” protocol adapter error
- Chrome your connection is not a private connection solution
- Error:Connection activation Failed: no suitable device found for this connection solution