
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

String customer_id = request.getParameter("customer_id"); String f_name = request.getParameter("f_name"); String l_name = request.getParameter("l_name"); String mobile_no = request.getParameter("mobile_no"); String address = request.getParameter("address");
try { //loading driver
Class.forName("oracle.jdbc.driver.OracleDriver");
//creating connection with the database Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE [kavindu on KAVINDU]","kavindu","123456");
PreparedStatement ps = con.prepareStatement("insert into COMPACT_DISK values(?,?,?,?,?)");
ps.setString(1, customer_id); ps.setString(2, f_name); ps.setString(3, l_name); ps.setString(4, mobile_no); ps.setString(5, address); int i = ps.executeUpdate();
if (i > 0) { //out.println("Compact disk successfully inserted"); RequestDispatcher d = request.getRequestDispatcher("new.html"); d.forward(request, response); } } catch (ClassNotFoundException | SQLException | ServletException | IOException se) { out.println("Error Occured : \n" + se.getLocalizedMessage()); } }