| Home | JSP | EJB | JDBC | Java Servlets | WAP | Free JSP Hosting | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML | ||||
|
||||
|
|
||||
| Tutorial Categories: Ajax
| Articles
| JSP
| Bioinformatics
| Database
| Free
Books |
Hibernate
| J2EE
| J2ME
| Java
| JavaScript
| JDBC
| JMS
| Linux
| MS
Technology |
PHP
| RMI
| Web-Services
| Servlets
| Struts
| UML
|
|
||||||||||||||||||||||||||||||
|
Home | JSP | EJB | JDBC | Java Servlets | WAP | Free JSP Hosting | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs |
||||||||||||||||||||||||||||||
Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.
Copyright © 2007. All rights reserved.
Current Comments
6 comments so far (post your own) View All Comments Latest 10 Comments:i want to be able to update my data-base through the internet using jsp. please how can i do this.
thanks.
Posted by cues on Saturday, 04.5.08 @ 01:15am | #55355
dear sir/madam
i am facing problem in jsp. i want to insert form into database using jsp page.
how to fetch data from html page and how to fetch on jsp page and insert into database.
please reply..
plz.............
i am trying to solve problem last 2 days..
Posted by sandip on Thursday, 03.27.08 @ 11:58am | #54470
Without using submit button insert the values in html page automatic insert the values in db using in ajax in java
Posted by gupta on Tuesday, 02.19.08 @ 16:57pm | #49082
HI,
You use the following code in JSP page.
String connectionURL = "jdbc:mysql://localhost/zulfiqar";
Connection connection=null;
ResultSet rs;
res.setContentType("text/html");
PrintWriter out = res.getWriter();
//get the variables entered in the form
String uId = req.getParameter("userId");
String fname = req.getParameter("firstname");
String sname = req.getParameter("surname");
String address1 = req.getParameter("address1");
String address2 = req.getParameter("address2");
String town = req.getParameter("town");
String county = req.getParameter("country");
String zipcode = req.getParameter("zipcode");
try {
// Load the database driver
Class.forName("org.gjt.mm.mysql.Driver");
// Get a Connection to the database
connection = DriverManager.getConnection(connectionURL, "root", "admin");
//Add the data into the database
String sql = "insert into emp_details values (?,?,?,?,?,?,?,?)";
PreparedStatement pst = connection.prepareStatement(sql);
pst.setString(1, uId);
pst.setString(2, fname);
pst.setString(3, sname);
pst.setString(4, address1);
pst.setString(5, address2);
pst.setString(6, town);
pst.setString(7, county);
pst.setString(8, zipcode);
int numRowsChanged = pst.executeUpdate();
// show that the new account has been created
out.println(" Hello : ");
out.println(" '"+fname+"'");
pst.close();
}
catch(ClassNotFoundException e){
out.println("Couldn't load database driver: " + e.getMessage());
}
catch(SQLException e){
out.println("SQLException caught: " + e.getMessage());
}
Thanks
Posted by Vinod on Tuesday, 02.12.08 @ 12:26pm | #47989
I want to insert data into mysql database using jsp.How can i do it?
Posted by Lisa on Tuesday, 02.12.08 @ 11:51am | #47985
Great web site really useful for developers
Posted by vasu on Tuesday, 04.10.07 @ 15:21pm | #13714