• 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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
Ranch Hand
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 + " )";
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!