File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes jdbc-servlets (Insert record into file) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "jdbc-servlets (Insert record into file)" Watch "jdbc-servlets (Insert record into file)" New topic

jdbc-servlets (Insert record into file)

Joe Lopes

Joined: Dec 27, 2000
Posts: 4
Hi friend,
I have wrote servlet program with JDBC and wanted to insert a record into my log file using sql statement.
I wanted to insert program variable field values into file field.
Pgm Variable
String user = "Joe";
String add="address";
Sql Statement
"Insert into log (name, address) values(<user>, <add>)";
How do I insert value from user & add variable into log file in name and address field. what is the syntax.
Thank you very much and appreciate quick response as I am developing the pgm and stuck with above problem.
Joe Lopes.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
You have to build a String:
String s = "Insert into log (name, address) values(" + user + " ," + add + " )";

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
I agree. Here's the link:
subject: jdbc-servlets (Insert record into file)
It's not a secret anymore!