• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC Parameters as Context Parameters?

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have my JDBC parameters set as context parameters in my web.xml file as such:



Is this ok to do? Or a bad idea? I know it works, and did it primarily so I could maintain these attributes through just the web.xml file.
[ March 29, 2007: Message edited by: Jenn Person ]
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is OK to do what you are doing.

But a better approach is to let your Web/App server handle database connections. They handle it in a more efficient manner.

Which web/app server are you using?
[ March 30, 2007: Message edited by: Sunil Vasudevan ]
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do not you use the connection pool provided by the container as Sunil mentioned? Or , if you want to go by this approach then it would be bettter to have a db.properties file within your application , which would have all the connection related parameters.
 
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it is for learning purposes..how to use context parameters then it is fine..

But for an application in production environment ,it is better to go by what the others mentioned in the above posts...
 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Folks...

I am curious to learn things, what you mentioned as 'other' methods...

How does Container/Server Managed DB connections or connection pooling work...

Please advice me on the above
 
Jenn Person
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've never used, or been aware of , a connection pool. I'll have to look into that.

Otherwise, besides less efficiency, are there any other setbacks to making them context parameters in terms of security perhaps?
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not see and security threat to your approach as this (web.xml) would be within the WEB-INF directory.In fact I have worked on some application where some parameters are passed to the application using the init-param.
 
reply
    Bookmark Topic Watch Topic
  • New Topic