I have done the connection with Oracle 10g Xe database through the following code.
Context ctx=new InitialContext();
DataSource ds=(DataSource)ctx.lookup("java:OracleDS");
Connection con=ds.getConnection();
String mob=request.getParameter("mob_no");
String pass=request.getParameter("pass");
Statement stmt=con.createStatement();
//checking login details
String sql="select * from user1 where mob_no='"+mob+"' and password='"+pass+"'";
ResultSet rs=stmt.executeQuery(sql);
String sql2="select * from postpaid where mob_no='"+mob+"'";
ResultSet rs2=stmt.executeQuery(sql2);
if(rs.isBeforeFirst())
{
while(rs2.next())
{
if(rs2.getInt(2)!=0)
{
out.println("You have total due of "+rs2.getInt(2));
out.println("<a href=\"paybill.jsp\">Pay Bill</a>");
}
else {
out.println("You have no dues!!!!!");
}
}
}
else
{
out.println("Invalid login details.....<a href=\"#\">Back to home page</a>");
}
My program always shows the result "Invalid login Details"
Aucun commentaire:
Enregistrer un commentaire