• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

jdbc-servlets (Insert record into file)  RSS feed

 
Greenhorn
Posts: 4
  • 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.
 
mister krabs
Posts: 13974
  • 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 + " )";
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!