Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ page contentType="text/html; charset=iso-8859-1" language="java"
- import="java.sql.*" errorPage="" %>
- <%
- PreparedStatement stmt = null;
- Connection conn = null;
- try {
- //Connect to the database
- Class.forName("oracle.jdbc.driver.OracleDriver");
- String hostname = "172.16.60.13";
- int port = 1521;
- String sid = "orcl";
- String oracleURL = "jdbc:oracle:thin:@"+hostname+":"+port+":"+sid;
- String user = "E183383";
- String pass = "183383";
- conn = DriverManager.getConnection(oracleURL, user, pass);
- //Create an empty new variable
- String message = null;
- String fname = request.getParameter("fname");
- String lname = request.getParameter("lname");
- String username = request.getParameter("user_id");
- String password = request.getParameter("password");
- String address = request.getParameter("Address");
- String phone = request.getParameter("user_phone");
- String category = request.getParameter("Category");
- // Make the query
- stmt=conn.prepareStatement("insert into lb_user values(?,?,?,?,?,?,?,?)");
- stmt.clearParameters();
- stmt.setString(1,fname);
- stmt.setString(2,lname);
- stmt.setString(3,username);
- stmt.setString(4,password);
- stmt.setString(5,address);
- stmt.setString(6,phone);
- stmt.setString(7,category);
- stmt.setString(8,"0");
- //Run the query
- stmt.executeUpdate();
- conn.commit();
- out.println("<p> <b> You have been registered !</b></p>");
- //Close the database connection
- stmt.close();
- conn.close();
- } catch (SQLException ex) {
- out.println("<p><b> Could not be registered due to a system error. </b></p><p>" + ex.getMessage()+ "</p>");
- stmt.close();
- conn.close();
- }
- %>
- <html>
- <body>
- <script>
- alert("Your ID has been successfully created!");
- </script>
- </body>
- </html>
- <%
- response.setHeader("Refresh", "0;url=LogIn-User.html");%>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement