Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  

servelet and jdbc programming



Share on Google+Share on Google+

Shridhu Chandel
servelet and jdbc programming
3 Answer(s)      8 years ago
Posted in : XML
View Answers

March 21, 2009 at 4:17 AM

Hi friend,

Some steps to be remember for solving the problem :

1.Create a html page "stud.html".


<title>New Page 1</title>


<form method="POST" action="/student">
<!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.txt";
S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p>Student Name:<input type="text" name="student_name" size="20"></p>
<p>Enrollment No: <input type="text" name="enrollment_no" size="20"></p>
<p>Course Code: <input type="text" name="course_code" size="20"></p>
<p>Regional Center Code: <input type="text" name="regional_center_code" size="20"></p>
<p>E-mail Id: <input type="text" name="email_id" size="20"></p>
<input type="submit" value="Submit" name="submit"></p>



March 21, 2009 at 4:18 AM

Step 2 : create a servlet class ""

import java.lang.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Student extends HttpServlet{
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException{
PrintWriter pw = response.getWriter();
String connectionURL = "jdbc:mysql://localhost/zulfiqar";;
Connection connection;

String student_name = request.getParameter("student_name");
String enrollment_no = request.getParameter("enrollment_no");
String course_code = request.getParameter("course_code");
String regional_center_code = request.getParameter("regional_center_code");
String email_id = request.getParameter("email_id");

connection = DriverManager.getConnection(connectionURL, "root", "admin");
PreparedStatement pst = connection.prepareStatement("insert into emp_info values(?,?,?,?,?)");


int i = pst.executeUpdate();
pw.println("<br>Record has been inserted");
pw.println("failed to insert the data");
catch (Exception e){

March 21, 2009 at 4:20 AM

3.In web.xml action mapping of servlet.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"




Related Tutorials/Questions & Answers:
servelet and jdbc programming - XML
servelet and jdbc programming  Write a program using Servlet and JDBC for developing an online submission of an examination form. You are required...(); String connectionURL = "jdbc:mysql://localhost/zulfiqar"; Connection
problem in creating web application using servelet, jsp, jdbc and xml - JSP-Servlet
problem in creating web application using servelet, jsp, jdbc and xml  Using Servlet, JSP, JDBC and XML create a web application for a courrier... the technologies JSP,Servlet and JDBC etc... Thanks
Servelet methods
Servelet methods  In my project we use the sendRedirect method which is nt working in our project i would like to know whether there is any other method which can be used instead of sendRedirect
java programming - JDBC
java programming  Develop a simple OPAC system for library using even-driven and concurrent programming paradigms of Java. Use JDBC to connect to a back-end database.please reply immediately sir
applet and servelet
applet and servelet  How will you establish the connection between the servelet and an applet?  Hi, From applet you can use the URL class to call the servlet. URL servletURL = new URL( location ); URLConnection
Programming error - JDBC
Programming error  import javax.servlet.*; import...=DriverManager.getConnection("jdbc:odbc:Odsn"); Statement s=con.createStatement(); int x...("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc
java programming problem - JDBC
java programming problem  Hi, Request you to provide the source code in Java for the following programming problem : upload .csv file data into oracle database. please send the solution to [email protected]
java programming problem - JDBC
java programming problem  Hi, Request you to provide a solution ( analysis & design & unit test plan & code & test criteria ) to the following problem to the following mail id : Problem : upload excel file data into oracle
java servlet programming - JDBC
programming through servlets Thanx   Hi friend, i am sending multiple
Programming in JDBC and JSP - JSP-Servlet
Programming in JDBC and JSP  Write a program using JDBC and JSP to display the names and addresses of all those MCA students at your study centre who have completed/submitted their theory assignments of all the courses of IV
jsp-servelet,error http404
jsp-servelet,error http404  I am using mysql commandclient to connect with eclipse using jsp and servelet. I keep getting the error hhtp 404...("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc
servelet connectivity with oracle using procedure
servelet connectivity with oracle using procedure   kindly elaborate how servlet code connect to oracle br using procedure
jdbc  Write a web based student registration application where the students can register online with their enrollment no. You are required to use JSP, Servelet and JDBC
how to create users using IBM Tivoi API in jsp/servelet?
how to create users using IBM Tivoi API in jsp/servelet?  how to create users using IBM Tivoi API in jsp/servelet
Programming  Given a number n, write a programming to determine its square root if it is possible, in the contraly case print an appropriate massege on the screen
Java Constructor programming for single and double constructor  write a program which have no argument constructor ,single parameter constructor constructor,double parameter constor,and the now when we create a object
JDBC Architecture
JDBC architecture can be classified in 2 broad categories:- 1. JDBC API 2. Types of JDBC Drivers JDBC API     JDBC programming interface... the Drivers found in JDBC environment, load the most appropriate driver
JDBC  why we use batch in jdbc
jdbc  display the records using index in jdbc
jdbc  Hai , Give a steps for jdbc connectivity
JDBC  How to add set of queries in a single query in JDBC
jdbc  please tell me sir.i dont know JDBC connection and how to create table in database
jdbc   how to write program to save data and retrieve data from the form in Java
jdbc  why do we need to load jdbc drivers before connecting to database
JDBC  how to set classpath for eclipse, java, where to copy jdbc connector
JDBC  in class.forname which driver name we are writing for the connection from jdbc to sqlserver 2008
jdbc  is it possible to use doget & dopost method with jdbc to call in a servlet programe
Jdbc  A java program with jdbc connectivity with insert,delete,update options for name,regno,mark1,mark2,total