java.sql.SQLException:侦听器拒绝连接时出现以下错误:ORA-12505,TNS:侦听器当前不知道连接描述符中给出的SID客户端使用的连接描述符是:localhost:1521:XE < / p>
当我尝试连接时,我在网页上收到此错误
这是我的代码
Valid.jsp
<%@ page import="java.sql.*" %>
<html>
<body>
<%
String u=request.getParameter("t1");
String p=request.getParameter("t2");
if(u.equals("aptech") && p.equals("aptech"))
{
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
out.println("Registered\n");
Connection con =DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","aptech");
Statement st = con.createStatement();
out.println("Connected\n");
PreparedStatement pst = con.prepareStatement("insert into users values(?,?)" );
pst.setString(1,u);
pst.setString(2,p);
pst.execute();
out.println("Successfully Inserted Into Database");
}
catch(Exception e)
{
out.println(e);
}
}
else
{
out.println("Invalid Login");
}
%>
</body>
</html>
&#13;
Login.html
<html>
<body>
<form action="Valid.jsp">
UserName:<input type="text" name="t1">
Password:<input type="text" name="t2">
<input type="submit" value="submit">
</form>
</body>
</html>
&#13;