连接oracle数据库,出现异常:java.sql.SQLException: Io 异常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153092352)(ERR=12504)(ERROR_STACK=(ERROR=(CODE=12504)(EMFI=4))))
请问是什么出现的问题?谢谢
import java.sql.*;
public class GetResultExample1{
public static void main(String args[]){
try{
new oracle.jdbc.driver.OracleDriver();
String url="jdbc:oracle:thin:@localhost:1521:o9i";
Connection conn=DriverManager.getConnection(url,"scott","tiger");
Statement stmt=conn.createStatement();
//执行查询语句
ResultSet rs=stmt.executeQuery(
"select * from student order by student_id");
while(rs.next()){
System.out.println("----------------------------------");
System.out.println("student id: "+rs.getString(1)
+" student name: "+rs.getString(2));
}
stmt.close();
conn.close();
}catch(SQLException e){
e.printStackTrace();
}
}
}
请问是什么出现的问题?谢谢
import java.sql.*;
public class GetResultExample1{
public static void main(String args[]){
try{
new oracle.jdbc.driver.OracleDriver();
String url="jdbc:oracle:thin:@localhost:1521:o9i";
Connection conn=DriverManager.getConnection(url,"scott","tiger");
Statement stmt=conn.createStatement();
//执行查询语句
ResultSet rs=stmt.executeQuery(
"select * from student order by student_id");
while(rs.next()){
System.out.println("----------------------------------");
System.out.println("student id: "+rs.getString(1)
+" student name: "+rs.getString(2));
}
stmt.close();
conn.close();
}catch(SQLException e){
e.printStackTrace();
}
}
}
关于ORACLE的ora-12505报错以及连接问题的解决及相关资料 JDBC报错:Connection refused(DESCRIPTION=(TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))