Java.sql.sqlexception Listener Refused The Connection With The Following Error Ora-12505
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions ora 12505 error in sql developer you might have Meta Discuss the workings and policies of this listener refused the connection with the following error ora-12505 in oracle sql developer site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers ora 12505 error in oracle 11g or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a
Listener Refused The Connection With The Following Error Ora-12514
community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Java Oracle localhost connection error (ORA-12505) up vote 3 down vote favorite I am trying to currently connect to a database on my current computer. import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class ora 12505 error in oracle 12c Main { public static void main(String[] argv) throws Exception { Connection connection = null; try { // Load the JDBC driver String driverName = "oracle.jdbc.driver.OracleDriver"; Class.forName(driverName); // Create a connection to the database String serverName = "localhost"; String portNumber = "1521"; String sid = "xe"; String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid; String username = "scott"; String password = "tiger"; connection = DriverManager.getConnection(url, username, password); System.out.println("Success"); } catch (ClassNotFoundException e) { System.out.println("Class Not Found Error"); } } } I keep getting this error and I do not know why... 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 The Connection descriptor used by the client was: localhost:1521:xe at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70) at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:110) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:171) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:496) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:411) at oracle.jdbc.driver.PhysicalConnection.
here for a quick overview of the site Help Center Detailed answers to any questions you might have listener refused the connection with the following error ora-12519 Meta Discuss the workings and policies of this site About Us
Listener Refused The Connection With The Following Error Ora-12528
Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with
Ora-12505 Jdbc Thin Client
us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, http://stackoverflow.com/questions/6805705/java-oracle-localhost-connection-error-ora-12505 just like you, helping each other. Join them; it only takes a minute: Sign up JDBC: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor up vote 1 down vote favorite I am using Oracle 12C as my database. I've written a small JDBC connection program in Java but I am facing an http://stackoverflow.com/questions/30861061/jdbc-ora-12505-tnslistener-does-not-currently-know-of-sid-given-in-connect-de issue with the listener. import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class JdbcConnection { public static void main(String[] args) throws SQLException,ClassNotFoundException { String url = "jdbc:oracle:thin:@localhost:1521:orcl"; String user = "system"; String password = "password"; Connection connection = null; Class.forName("oracle.jdbc.driver.OracleDriver"); connection = DriverManager.getConnection(url, user, password); if(connection!=null){ System.out.println("Success in connnection"); } else { System.out.println("failure in connection "); } } } I am getting the following exception: C:\Users\Administrator\Desktop>java JdbcConnection Exception in thread "main" java.sql.SQLException: Listener refused the connectio n with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor The Connection descriptor used by the client was: localhost:1521:orcl at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java :112) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java :261) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387) at oracle.jdbc.driver.PhysicalConnection.
Επιλέξτε τη γλώσσα σας. Κλείσιμο Μάθετε περισσότερα View this message in English Το YouTube εμφανίζεται στα Ελληνικά. Μπορείτε να αλλάξετε αυτή την προτίμηση παρακάτω. Learn more https://www.youtube.com/watch?v=vNJ7x_R7vN8 You're viewing YouTube in Greek. You can change https://chartio.com/resources/tutorials/how-to-fix-ora-12505-tns-listener-does-not-currently-know-of-sid-given-in-connect-descriptor this preference below. Κλείσιμο Ναι, θέλω να τη κρατήσω Αναίρεση Κλείσιμο Αυτό το βίντεο δεν είναι διαθέσιμο. Ουρά παρακολούθησηςΟυράΟυρά παρακολούθησηςΟυρά Κατάργηση όλωνΑποσύνδεση Φόρτωση... Ουρά παρακολούθησης Ουρά __count__/__total__ ORA-12505: TNS:listener does not currently listener refused know of SID given in connect descriptor INNo MATHs ΕγγραφήΕγγραφήκατεΚατάργηση εγγραφής144144 Φόρτωση... Φόρτωση... Σε λειτουργία... Προσθήκη σε... Θέλετε να το δείτε ξανά αργότερα; Συνδεθείτε για να προσθέσετε το βίντεο σε playlist. Σύνδεση Κοινή χρήση Περισσότερα Αναφορά Θέλετε να αναφέρετε το listener refused the βίντεο; Συνδεθείτε για να αναφέρετε ακατάλληλο περιεχόμενο. Σύνδεση Στατιστικά στοιχεία 25.106 προβολές 153 Σας αρέσει αυτό το βίντεο; Συνδεθείτε για να μετρήσει η άποψή σας. Σύνδεση 154 6 Δεν σας αρέσει αυτό το βίντεο; Συνδεθείτε για να μετρήσει η άποψή σας. Σύνδεση 7 Φόρτωση... Φόρτωση... Φόρτωση... Η δυνατότητα αξιολόγησης είναι διαθέσιμη όταν το βίντεο είναι ενοικιασμένο. Αυτή η λειτουργία δεν είναι διαθέσιμη αυτήν τη στιγμή. Δοκιμάστε ξανά αργότερα. Δημοσιεύτηκε στις 27 Νοε 2015solution of error:Status : Failure -Test failed: Listener refused the connection with the following error:ORA-12505, TNS:listener does not currently know of SID given in connect descriptor Κατηγορία Εκπαίδευση Άδεια Τυπική άδεια YouTube Εμφάνιση περισσότερων Εμφάνιση λιγότερων Φόρτωση... Διαφήμιση Αυτόματη αναπαραγωγή Όταν είναι ενεργοποιημένη η αυτόματη αναπαραγ
connect to the appropriate Oracle database, we'll need to expound a bit on how Oracle behaves and, therefore, what is causing this issue in the first place. SIDs vs SERVICE_NAMES It is important to understand the (slight) difference between what Oracle defines as a SID compared to a SERVICE_NAME, as we'll use this information to create a proper connection string later on. In Oracle, the system identifier (or SID) is a local identifier of up to eight characters in length that is used to identify a particular database and differentiate it from other databases on the system. Often the SID is the prefix word or DB_UNIQUE_NAME that precedes the DB_DOMAIN. For example, the SID of our bookstore database, as seen in in the full global database name of bookstore.company.com. SERVICE_NAMES, on the other hand, represent the names by which database instances can be connected to. A SERVICE_NAME will typically follow the format of the SID followed by the database domain, like so: DB_UNIQUE_NAME.DB_DOMAIN The TNS Listener When a client is attempting to connect to an Oracle database, rather than connecting to the database directly, there is a broker service that intervenes and handles the connection request for the client. This broker application is known as the listener and it performs the task of listening for incoming client requests. When a request is received, the listener processes and forwards that request onto the appropriate Oracle database server using a service handler, which just acts as the connection between the listener and the database server. TNS Names and Configuration When connecting to an Oracle database, typically your database server will have tnsnames.ora, which is a configuration file that informs the server about NET_SERVICE_NAMES which are valid database connections. By default, this file is located at ORACLE_HOME/network/admin. For example, a NET_SERVICE_NAME descriptor in tnsnames.ora may be formatted like this: myDatabaseNetService = (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp)(HOST = localhost)(PORT = 1521)(QUEUESIZE = 100)) (CONNECT_DATA = (SERVICE_NAME = bookstore.company.com) ) ) This would define a NET_SERVICE_NAME using the SERVICE_NAME we discussed earlier (bookstore.company.com) and connecting to localhost through port 1521. Connection String With a bit more knowledge about how Oracle actually connects to databases, we can now look at how connection strings are formatted. Connect via TNS Name/NET_SERVICE_