User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 391,864 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,613 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting

How to insert data into database?

Join Date: May 2005
Posts: 2
Reputation: obelisk is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
obelisk obelisk is offline Offline
Newbie Poster

Re: How to insert data into database?

  #3  
May 9th, 2005
I did this:

------------------------------------
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>

<%!
String firstname= request.getParameter("FIRSTNAME");
String lastname = request.getParameter("LASTNAME");
String address1 = request.getParameter("ADDRESS");
String address2= request.getParameter("ADDRESS2");
String address3 = request.getParameter("ADDRESS3");
String city = request.getParameter("CITY");
String province = request.getParameter("PROVINCE");
String memo = request.getParameter("MEMO");
%>
<%

Class.forName("com.mysql.jdbc.Driver");

Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/funeral", "root", "abc123");

Statement statement = connection.createStatement();
String sql = ("INSERT INTO memory VALUES ('" + firstname + "','" + lastname + "','" + address1 + "','"+ address2 +"','"+ address3 +"','"+ city +"','"+ postalcode +"','"+ province +"','"+ memo +"') ");

rs.close();
connection.close();

%>
----------------------------------------------------------------------
But still, not working.
Reply With Quote  
All times are GMT -4. The time now is 6:44 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC