Salve a tutti.
Premetto che sto trovando l'argomento molto ostico, ma non per questo perdo pazienza o mi scoraggio u.u.
Sto provando a creare un'applicazione di prova Java/Sql ma non riesco a connettermi correttamente. Dopo che lancio questo codice:
Ottento tutto questo messaggio:codice:import java.sql.DriverManager; import java.sql.Connection; import java.sql.SQLException; public class ApplicationSQL { public static void main(String[] argv) { System.out.println("-------- Oracle JDBC Connection Testing ------"); try { Class.forName("oracle.jdbc.driver.OracleDriver"); } catch (ClassNotFoundException e) { System.out.println("Where is your Oracle JDBC Driver?"); e.printStackTrace(); return; } System.out.println("Oracle JDBC Driver Registered!"); Connection connection = null; try { connection = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:NOME_DB", "utente", "password"); } catch (SQLException e) { System.out.println("Connection Failed! Check output console"); e.printStackTrace(); return; } if (connection != null) { System.out.println("You made it, take control your database now!"); } else { System.out.println("Failed to make connection!"); } } }
Dov'è che mi sto perdendo? >.<codice:-------- Oracle JDBC Connection Testing ------ Oracle JDBC Driver Registered! Connection Failed! Check output console 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:743) at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:566) at java.sql.DriverManager.getConnection(DriverManager.java:579) at java.sql.DriverManager.getConnection(DriverManager.java:221) at ApplicationSQL.main(ApplicationSQL.java:29) 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.NSProtocolStream.negotiateConnection(NSProtocolStream.java:275) at oracle.net.ns.NSProtocol.connect(NSProtocol.java:264) at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1452) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:496) ... 6 more

Rispondi quotando