Home > database >  Help | JDBC Connection oracle error Connection refused
Help | JDBC Connection oracle error Connection refused

Time:10-21


This is an error information
 public class DBUtil {
Public static Connection getConnection () {
Connection conn=null;
Try {
Class.forname ("... The oracle JDBC driver OracleDriver ");//find the oracle driver's class
The String url="JDBC: oracle: thin: @ 192.168.211.1:1521: wouldn";//URL address
String username="c # # ADMIN";
String password="admin";
Conn=DriverManager. GetConnection (url, username, password);

} the catch (a ClassNotFoundException e) {
//TODO Auto - generated the catch block,
e.printStackTrace();
} the catch (SQLException e) {
//TODO Auto - generated the catch block,
e.printStackTrace();
}
return conn;
}
Public static void close (PreparedStatement PSTMT) {
If (PSTMT!=null) {
Try {
PSTMT. Close ();
} the catch (SQLException e) {

e.printStackTrace();
}
}
}

Public static void close (ResultSet rs) {
if(rs !=null) {
Try {
rs.close();
} the catch (SQLException e) {
//TODO Auto - generated the catch block,
e.printStackTrace();
}
}
}
}

code

CodePudding user response:

Look at the prompt, should you request stopped the firewall,

CodePudding user response:

Use up sqlplus first identified as a DB problem or a problem with the network layer

CodePudding user response:

I'm the same problem, used a local database
  • Related