jQuery in Action, 3rd edition
The moose likes JDBC and Relational Databases and the fly likes Problem in inserting data into access database through jsp file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Reply locked New topic

Problem in inserting data into access database through jsp file

kanwal mandair

Joined: Dec 06, 2008
Posts: 8
Hi all,
I am a second year student and this is my semester project worth 55% and i dont have much knowledge about making connection b/w html form and access database so i tried it doing with the help of jsp but it is not working this is my html code:

<title>Student Co-op Willingness Form</title>
<form name="myform" action="example5.jsp" method=post>
<table border=0>
<td><input type="text" name="tid" size=15 /></td>

<td>Enrollment No.:</td>
<td><input type="text" name="enroll" size=15 /></td>

<td><input type="text" name="name" size=15/></td>

<td><input type="text" name="course" size=15/></td>

<td><input type="text" name="semester" size=15/></td>

<td><input type="text" name="company" size=15/></td>

<td><input type="text" name="skills" size=20/></td>

<td><input type="text" name="email" size=20/></td>

<td>Contact No.:</td>
<td><input type="text" name="contact" size=20/></td>

<td><input type="radio" name="radwt" value="1" size="5" >1 </td>
<td><input type="radio" name="radwt" value="2" size="5">2</td>
<td><input type="radio" name="radwt" value="3" size="5">3</td>

<td>Willing to opt for co-op:</td>
<td><input type="radio" name="radwc" value="yes"size="5" >Yes </td>
<td><input type="radio" name="radwc" value="no" size="5">No </td>

<td style="text-align:left">Co-op Arrangement:</td>
<td style="text-align:left">
<select name="arrange">
<option value="On Your Own">On Your Own</option>
<option value="By Institute">By Institute</option>




<td><input type="submit" value="Submit"/></td>
<td><input type="reset" /></td>

this is my jsp file:

<%@ page import="java.sql.*" %>
String url = "jdbcdbc:final";
Connection conn = null;
String classPath = "sun.jdbc.odbc.JdbcOdbcDriver";
conn = DriverManager.getConnection(url);
}catch(Exception exc){
Statement stm=null;
String id;
String enroll;
String name;
String course;
String semester;
String company;
String skills;
String email;
String contact;
String workterm;
String willing;
String arrange;

id = request.getParameter("tid");
enroll = request.getParameter("enroll");
name = request.getParameter("name");
course = request.getParameter("course");
semester = request.getParameter("semester");
company = request.getParameter("company");
skills = request.getParameter("skills");
email = request.getParameter("email");
contact = request.getParameter("contact");
workterm = request.getParameter("radwt");
willing = request.getParameter("radwc");
arrange = request.getParameter("arrange");
stm= conn.createStatement();
String query = "INSERT INTO Student VALUES ("+ id +", " + enroll +", "+
name + "," + course +", "+ semester + ", "+ company +", " + skills +", "+
email + "," + contact +", "+ workterm + "," + willing +", "+
arrange + ")";
out.println("The data was added to the table successfully!");
}catch(Exception exc){
out.println("Inserting data failed!");
<br><br><a href="coop.html">Add more record</a>
Please help me out. I am getting an error inserting data failed..... please please i have to submit it within two days

[ December 06, 2008: Message edited by: kanwal mandair ]
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1710
Duplicate Post

I agree. Here's the link: http://aspose.com/file-tools
subject: Problem in inserting data into access database through jsp file
It's not a secret anymore!