MerlinQiu 2015-10-04 08:51 采纳率: 0%
浏览 1767

报错:ORA-12505 求解答

报错: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
(有两个类,一个是登录类,一个是登录的处理类)
主要代码:(登录类)
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

response.setContentType("text/html; charset=utf-8");
PrintWriter out=response.getWriter();
out.print("

welcome


");
out.print("
" +
"ID:
" +
"Password:
" +
"
" +
"");

}

处理类的代码:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub

request.setCharacterEncoding("utf-8");
response.getWriter().print("aaaa");
String id=request.getParameter("id");
String password=request.getParameter("password");

Connection ct=null;
ResultSet rs=null;
PreparedStatement ps=null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
ct=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:merlin","SCOTT","tiger");
ps=ct.prepareStatement("selcet * from U where id=? and password=?");
ps.setObject(1, id);
ps.setObject(2, password);
rs=ps.executeQuery();
if(rs.next())
{
request.getRequestDispatcher("/MainFrame").forward(request, response);
}else{
request.getRequestDispatcher("/Login").forward(request, response);
}

} catch (Exception e) {
e.printStackTrace();
// TODO: handle exception
}

}
网上有改listener.ora的说法,我改了还是不行啊

listener.ora Network Configuration File: D:\app\Merlin\product\11.2.0\dbhome_1\network\admin\listener.ora

Generated by Oracle configuration tools.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\Merlin\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\Merlin\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = D:\app\Merlin\product\11.2.0\dbhome_1)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)

ADR_BASE_LISTENER = D:\app\Merlin

  • 写回答

4条回答 默认 最新

  • threenewbee 2015-10-04 17:27
    关注

    oracle账户的问题或者配置的文件,拒绝连接。

    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能