this may not be the best solution ...what i feel is
U can open a data base connection to your database ..
then create a table with columns corresponding to the fieldnames in the form data (you can retrive the form data using req.getParameter(parametername); where req is the HttpServletRequest object. in ur doGet() or doPost().
then u can just insert the values in to corresponding columns using statement.executeQuery(sqlquery);
 
You can use prepared statements also which is kinda more organised ...
for example:
I GOT THIS FROM THE BOOK NAMED PROF JAVA SERVER PROGRAMMING.
 
RETRIEVING FORM DATA:
    String sales[] =new String[5];
             sales[0]=req.getParamer("quantity");
             sales[1]=req.getParameter("revenue");
             .........
              ..........
CREATING THE PREPARED STATEMENT
           StringBuffer sql=new StringBuffer(500);
           sql.append("INSERT INTO dailySales(date,qtySold,revenue)");
           sql.append("VALUES(?,?,?)");
           PreparedStatement stmt  =dbCon.prepareStatement(sql.toString());
           /* dbCon is ur Connection Object*/
          
INSERT THE RECORDS TO DATABASE
         
 stmt.setDate(1,new java.sql.Date(System.currentTimeMillis()));
 stmt.setInt(2,Interger.parseInt(sales[0]));
 stmt.setDouble(3,Double.parseDouble(sales[1]));
 stmt.executeUpdate();
 
 
i hope this helps.
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of KrIsHnA
Sent: Thursday, March 16, 2000 10:03 AM
To: [EMAIL PROTECTED]
Subject: how to write to access using jdbc servlet!

please let me know how i can parse form data and writeinto a database(MSAccess).None of the books or sites have a sample program or even amention of this.they simply concentrate on retrieving from a database.please refer any URL's for any samples you might know.
                                                                            thanks and regards
                                                                                krishna

Reply via email to