473,426 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,426 software developers and data experts.

an error while inserting data in access database through jsp

index.html page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>User Registration form</title>
</head>

<body>

<form action="registration.jsp" method="post">
<table align="center" width="70%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="19%">User Name</td>
<td width="10%">:</td>
<td width="71%"><input type="text" name="user_name" />
</td>
</tr>
<tr>
<td>User ID </td>
<td>:</td>
<td><input type="text" name="user_id" /></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input type="password" name="pswd"/></td>
</tr>
<tr>
<td>Mobile</td>
<td>:</td>
<td><input type="text" name="mobile" /></td>
</tr>
<tr>
<td>Email-id</td>
<td>:</td>
<td><input type="text" name="email_id" /></td>
</tr>
<tr>
<td>Address</td>
<td>:</td>
<td><input type="textarea" name="address" /></td>
</tr>
<tr>
<td>Date Of Birth </td>
<td>:</td>
<td><input type="text" name="dob" /></td>
</tr>
<tr>
<td>Marks in 10th</td>
<td>:</td>
<td><input type="text" name="marks10th" /></td>
</tr>
<tr>
<td>Marks in 12th</td>
<td>:</td>
<td><input type="text" name="marks12th" /></td>
</tr>
<tr>
<td>Marks in Graduation</td>
<td>:</td>
<td><input type="text" name="marksgraduation" /></td>
</tr>
<tr>
<td>Marks in Post Graduation</td>
<td>:</td>
<td><input type="text" name="markspg" /></td>
</tr>
<tr>
<td>Other Certification</td>
<td>:</td>
<td><input type="text" name="othercertification" /></td>
</tr>
<tr>
<td>Experience</td>
<td>:</td>
<td><input type="text" name="experience" /></td>
</tr><br/>
<tr >
<td></td>
<td ><br />
<input type="submit" value="Submit" /></td>
</tr>
</table>
</form>

</body>
</html>





registration.jsp page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >

<html>
<body>

<%@page language="java"%>
<%@page import="java.sql.*"%>
<%@page import="java.io.*"%>
<%@page import="java.util.*"%>

<%!

Connection con;
PreparedStatement pstmt;
//Statement stmt;
//ResultSet res;
String url,user_name,email,address,date_of_birth,other_ce rtification,user_id,password;
int marks_10,marks_12,marks_ug,marks_pg,experience;
int mobile;

%>

<%

DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
url = "jdbc:odbc:attendance";
con = DriverManager.getConnection(url);

user_name = request.getParameter("user_name");
email = request.getParameter("email_id");
address = request.getParameter("address");
date_of_birth = request.getParameter("dob");
other_certification = request.getParameter("othercertification");
user_id = request.getParameter("user_id");
password = request.getParameter("pswd");
mobile = Integer.parseInt(request.getParameter("mobile"));
marks_10 = Integer.parseInt(request.getParameter("marks10th") );
marks_12 = Integer.parseInt(request.getParameter("marks12th") );
marks_ug = Integer.parseInt(request.getParameter("marksgradua tion"));
marks_pg = Integer.parseInt(request.getParameter("markspg"));
experience = Integer.parseInt(request.getParameter("experience" ));
//stmt= con.createStatement();
//res = pstmt.executeQuery("select id from registration");
//sid = Integer.parseInt(res.getInt(id));
pstmt = con.prepareStatement("insert into registration(user_name,mobile,email,address,date_o f_birth,marks_10th,marks_12th,marks_ug,marks_pg,ot her_certification,experience,user_id,password) values(?,?,?,?,?,?,?,?,?,?,?,?,?)");

//res.setInt(1,sid);
pstmt.setString(1,user_name);
pstmt.setInt(2,mobile);
pstmt.setString(3,email);
pstmt.setString(4,address);
pstmt.setString(5,date_of_birth);
pstmt.setInt(6,marks_10);
pstmt.setInt(7,marks_12);
pstmt.setInt(8,marks_ug);
pstmt.setInt(9,marks_pg);
pstmt.setString(10,other_certification);
pstmt.setInt(11,experience);
pstmt.setString(12,user_id);
pstmt.setString(13,password);
pstmt.executeUpdate();
con.close();
%>

</body>
</html>

and the error is:

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: For input string: ""
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:358)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet .java:856)


root cause

java.lang.NumberFormatException: For input string: ""
java.lang.NumberFormatException.forInputString(Unk nown Source)
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
org.apache.jsp.registration_jsp._jspService(regist ration_jsp.java:69)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet .java:856)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet .java:856)


note The full stack trace of the root cause is available in the Tomcat logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.16
Aug 18 '10 #1
0 1659

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Thomas Tsang | last post by:
I am using ASP + IIS + MS access, when running the following codes: set Conn=Server.CREATEOBJECT("ADODB.CONNECTION") conn.open "DRIVER={Microsoft Access Driver (*.mdb)}; " &...
0
by: Mark Lewin | last post by:
Hi all I'm pulling my hair out over this particular problem and I'm wondering whether you clever people can help. I'm running the demo version of Access 2003, which I understand to be a...
1
by: Azel | last post by:
Hi, I am trying to learn ADO.net and I keep running into problems trying to insert data into my Access Database: data.mdb. here is my code: <code> // Database Variables
0
by: refer_to_website | last post by:
I am using VB.NET to insert a record into an Access database. The database table uses an AutoNumber for its primary key. How can I determine what value Access assigned to the primary key? All...
9
by: Zak Milas | last post by:
The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. Is the error I get when it get dbCmd.ExecuteNonQuery();. I have 15 fields to insert,...
0
by: PÃ¥l Eilertsen | last post by:
Hi, I have a ASP.Net application that uses a MS Access database. The site works fine when all databases resides locally but on my public server I need to use a different database where the main...
8
by: movieking81 | last post by:
Hello All - I have a set of asp pages with an Access Database for an employee database setup on a Server 2003 running IIS 6. Everything works great. Well, the time has come for the pages and the...
3
by: Nathan Sokalski | last post by:
When I attempt to access a Microsoft Access database from my website, I recieve the following error: Server Error in '/' Application....
2
by: mdismail | last post by:
hi guys i am new to php.In my project i am using mysql database i have to insert data from database in combo box.for example in first combo box country name is inserted i mean country name should...
18
by: boss1 | last post by:
Hi all, i m having a problem with inserting data in oracle db. When i use form action =(call self page) then data is inserting properly.But problem with when using form...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.