File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sql query in web.xml or property file

 
Ankur Bohra
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

anyone who can help me with some code example of writing a sql query in web.xml or property file.
as i am developing a application with a variable sql query which may change any time.

Select query
Update query
Insert Query
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would put it into a properties file. That way you can write code to reload the file contents at runtime when a particular URL is hit. That's not possible if you put it into web.xml (for which you'd need to reload the whole web application).
 
Ankur Bohra
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But how can i write a insert query in property, where each time my parameters changes
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But how can i write a insert query in property, where each time my parameters changes


How a property file would differ from web.xml if you are hard coding your SQL into them?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use prepared statements you can list your parameters as '?' symbols.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John Todd:


How a property file would differ from web.xml if you are hard coding your SQL into them?

Because property files can be reloaded at any time.
 
Radhakrishna Bhat
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what i do in my applications.

use context-param to store connection strings.

use properties file for Queries.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic