|
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.
|
- how to write to access using jdbc servlet! KrIsHnA
- Re: how to write to access using jdbc servlet... P.Yesudason
- Re: how to write to access using jdbc servlet... Hector Fabio Meza
- Re: how to write to access using jdbc servlet... Ajai Peddapanga
- Re: how to write to access using jdbc servlet... Jayakumar Mounagurusamy
