File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jdbc-servlets (Insert record into file)

 
Joe Lopes
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
e.g.
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
Posts: 13974
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to build a String:
String s = "Insert into log (name, address) values(" + user + " ," + add + " )";
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic