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:
127.0.0.1:1521:compiere
-----------------------------------------------
sid写错了。
解决办法是要知道数据库的sid,
select * from v$instance;
看一下你的机器正在跑的
SID的名字是什么
其中instance_name就是。
-------------------------------------------
Connection conn = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:compiere", "compiere", "lwh");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
1521:后面的就是sid