Database Error
ORA-12545: TNS:Cannot register with TSLS (TNS Listener Service)
What This Error Means
This error occurs when the Oracle JDBC driver is unable to establish a connection with the TNS Listener Service due to a mismatch in the service names or due to the TNS Listener Service not being configured correctly.
Why It Happens
This error can happen when the database service name specified in the JDBC connection URL does not match the service name configured in the tnsnames.ora file or when the TNS Listener Service is not running or not configured correctly. It can also occur if the JDBC driver is not able to connect to the database due to a firewall or network issue.
How to Fix It
- 1To fix this error, you need to ensure that the database service name specified in the JDBC connection URL matches the service name configured in the tnsnames.ora file. You also need to ensure that the TNS Listener Service is running and configured correctly. Additionally, you can try to use the 'service_name' property in the JDBC URL instead of 'tns_entry' to specify the database service name.
Example Code Solution
String url = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=my_service_name)))";String url = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=correct_service_name)))";Fix for ORA-12545: TNS:Cannot register with TSLS (TNS Listener Service)
Browse Related Clusters
Related JAVA Errors
Related JAVA Blog Articles
Have a different error? Get an instant explanation.
Explain Another Error