-
Notifications
You must be signed in to change notification settings - Fork 0
/
requestjsp2.jsp
48 lines (43 loc) · 1.37 KB
/
requestjsp2.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<%@ page import ="java.sql.*"%>
<%
String email=request.getParameter("email");
String fname=request.getParameter("fname");
Long phno=Long.parseLong(request.getParameter("phno"));
String place=request.getParameter("place");
String street=request.getParameter("street");
String area=request.getParameter("area");
String city=request.getParameter("city");
int pin=Integer.parseInt(request.getParameter("pin"));
String service=request.getParameter("service");
Statement st;
try { Class.forName("oracle.jdbc.OracleDriver");
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:xe","username","password");
PreparedStatement ps=conn.prepareStatement("insert into requests values(?,?,?,?,?,?,?,?,?,?)");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:xe","username","password");
st=con.createStatement();
String q="select to_date(sysdate,'dd/mm/yyyy')from dual";
ResultSet rs=st.executeQuery(q);
while(rs.next())
{
ps.setString(1,email);
ps.setString(2,service);
ps.setString(3,fname);
ps.setLong(4,phno);
ps.setString(5,place);
ps.setString(6,street);
ps.setString(7,area);
ps.setString(8,city);
ps.setInt(9,pin);
ps.setDate(10,rs.getDate(1));
int i=ps.executeUpdate();
if(i!=0)
{ response.sendRedirect("requestsuccess.html"); }
else {
response.sendRedirect("requestfail.html"); }
}
}
catch(Exception e)
{
out.println(e);
}
%>