aspose file tools*
The moose likes JDBC and the fly likes define database connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
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.
 
Consider Paul's rocket mass heater.
 
subject: define database connection