I am using microsoft access as my database.
When i click on the button Enter Details nothing happen.
Please suggest where the mistake is.
The doGet method contains the following code
super.doGet(request, response);
String Name = request.getParameter("txtName");
String Designation = request.getParameter("txtDesignation");
Connection con = null;
PreparedStatement pstmt = null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:student_base");
pstmt = con.prepareStatement("Insert into student_base(Name, Designation) values(?,?)");
pstmt.setString(1, Name);
pstmt.setString(2, Designation);
pstmt.executeUpdate();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally {
try {
pstmt.close();
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
where as my jsp page contains the following
<body>
<form action="http://localhost:8080/ConnectingAccess/AddDetails.jsp" method="get">
<h3>This page add details in access database</h3>
<hr/>
Name: <input type="text" name="txtName" />
Designation: <input type="text" name="txtDesignation" />
<hr/>
<input type="button" name="btnEnter" value="Enter Details" />
</form>
</body>