Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 19th, 2006, 07:06 AM
Registered User
Join Date: Apr 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Im trying to insert data into mysql using jsp

Can you advice me on my code, im new to this- im trying to insert data into mysql using a jsp form.. Am i doing this correctly. any help, much appreciated.

<!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">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

        <form action="Registration.jsp" method=post>

        <table cellpadding=4 cellspacing=2 border=0>
        <th bgcolor="#CCCCFF" colspan=2>
        <tr bgcolor="#c8d8f8">
        <td valign=top>

        <b>First Name</b><br>
        <input type="text" name="firstName" value="" size=15 maxlength=20></td>
        <td valign=top>

        <b>Last Name</b><br>
        <input type="text" name="lastName" value="" size=15 maxlength=20></td>
        <tr bgcolor="#c8d8f8">
        <td valign=top>

        <input type="text" name="email" value="" size=25 maxlength=125>
        <td valign=top>

        <b>Date of Birth </b><br>
        <input type="text" name="dateOfBirth" value="" size=15 maxlength=5></td>
        <tr bgcolor="#c8d8f8">
        <td valign=top colspan=2>
        <div align="center">

        <b>Desired User Name</b><br>
              <input type="text" name="userName" size=30 value="" maxlength=10>
        <tr bgcolor="#c8d8f8">
        <td valign=top>

        <input type="password" name="password" size=10 value=""
        <td valign=top>

        <b>Confirm Password</b><br>
        <input type="password" name="password2" size=10 value=""
        <tr bgcolor="#c8d8f8">
        <td valign=top colspan=2>
        <div align="center">

          <input type="radio" name="notify" value="Yes" checked>
        <input type="radio" name="notify" value="No" >
        <tr bgcolor="#c8d8f8">
        <td align=center colspan=2>

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


////////////////////////////////jsp code
        Connection conn = null;
    String username= "lovers";
        String password= "project";
    String url= "jdbc:mysql://csserver.ucd.ie/lovers";

    String userName1 = request.getParameter("userName");
        String password1 = request.getParameter("password");
    String eaddress = request.getParameter("email");
        String dob = request.getParameter("dateOfBirth");
        String ************ = request.getParameter("notify");

            Class.forName("com.mysql.jdbc.Driver").newInstance ();
            conn = DriverManager.getConnection (url, userName, password);

            java.sql.Date age= java.sql.Date.valueOf(dob);

            PreparedStatment st;
            st = conn.prepareStatement("INSERT INTO REGISTRATION (USERID, USERNAME, PASSWORD, EMAIL, DATEOFBIRTH, ************) VALUES (?,?,?,?,?,?)");



        catch(Exception e)



Reply With Quote
  #2 (permalink)  
Old September 12th, 2006, 02:35 AM
Registered User
Join Date: Sep 2005
Location: Indore, M.P., India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sharad_iips2003 Send a message via Yahoo to sharad_iips2003

I am also getting a similar problem while inserting into a student table in database iips. If you now have the solution , please help....I would be very thankful to you...

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to insert datatable data in mysql with dnn rizwanrizi SQL Server ASP 0 August 26th, 2008 05:36 AM
PHP-MySQL Insert Data problem forexen PHP Databases 1 March 13th, 2007 12:58 AM
JSP-n-MySQL anshul JSP Basics 0 May 31st, 2005 02:21 AM
cannot insert into mysql:data LogicalDevloper Pro PHP 1 December 22nd, 2004 09:08 AM
Data Shaping Problem .. im stuck! jeuriks SQL Server ASP 2 March 19th, 2004 11:09 AM

All times are GMT -4. The time now is 11:01 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.