java 连接oracle报错java.sql.SQLException: Listener refused the connection with the following error代码为:String driver="oracle.jdbc.driver.OracleDriver";String url="jdbc:oracle:thin:@169.254.118.5:1521/orcl";String user="scott";String
来源:学生作业帮助网 编辑:作业帮 时间:2024/09/03 02:30:46
![java 连接oracle报错java.sql.SQLException: Listener refused the connection with the following error代码为:String driver=](/uploads/image/z/13516767-63-7.jpg?t=java+%E8%BF%9E%E6%8E%A5oracle%E6%8A%A5%E9%94%99java.sql.SQLException%3A+Listener+refused+the+connection+with+the+following+error%E4%BB%A3%E7%A0%81%E4%B8%BA%EF%BC%9AString+driver%3D%22oracle.jdbc.driver.OracleDriver%22%3B%05%05String+url%3D%22jdbc%3Aoracle%3Athin%3A%40169.254.118.5%3A1521%2Forcl%22%3B%05%05String+user%3D%22scott%22%3B%05%05String)
java 连接oracle报错java.sql.SQLException: Listener refused the connection with the following error代码为:String driver="oracle.jdbc.driver.OracleDriver";String url="jdbc:oracle:thin:@169.254.118.5:1521/orcl";String user="scott";String
java 连接oracle报错java.sql.SQLException: Listener refused the connection with the following error
代码为:
String driver="oracle.jdbc.driver.OracleDriver";
String url="jdbc:oracle:thin:@169.254.118.5:1521/orcl";
String user="scott";
String password="tiger";
try {
Class.forName(driver);
Connection conn=DriverManager.getConnection(url, user, password);//此处即为最后一行中所提的15行
System.out.println("成功得到链接");
conn.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
报错信息为:
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
The Connection descriptor used by the client was:
169.254.118.5:1521/orcl
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.(PhysicalConnection.java:490)
at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:202)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:465)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at maminjie.JDBC.访问数据库oracle.main(访问数据库oracle.java:15)
java 连接oracle报错java.sql.SQLException: Listener refused the connection with the following error代码为:String driver="oracle.jdbc.driver.OracleDriver";String url="jdbc:oracle:thin:@169.254.118.5:1521/orcl";String user="scott";String
String url="jdbc:oracle:thin:@169.254.118.5:1521/orcl";
take this
String url="jdbc:oracle:thin:@169.254.118.5:1521:orcl";