This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes define database connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "define database connection" Watch "define database connection" New topic
Author

define database connection

fang eve
Greenhorn

Joined: Jun 22, 2006
Posts: 26
Is it better to write all the database url, username, path in the web.xml or create 1 java function for it?
[ June 22, 2006: Message edited by: fang eve ]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Defining connection details in a suitable configuration file (possible web.xml) is usually better. That way you don't have to recompile your code to change databases.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
fang eve
Greenhorn

Joined: Jun 22, 2006
Posts: 26
oh.. but as in security concern web.xml is better?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Who has access to web.xml (or whatever configuration file you may choose)? In a properly secured application, only the administrator.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: define database connection
 
jQuery in Action, 3rd edition