We help IT Professionals succeed at work.

using a Web.Config in java

noreenburke
noreenburke asked
on
Medium Priority
971 Views
Last Modified: 2012-05-07
In asp and vb world I used a web.config file to store db connection strings and other common stuff.

If there a similar thing that can be used in the Java world to store connection strings without having to recompile the application?  

thanks
Comment
Watch Question

Author

Commented:
FYI::: the db is oracle 10g
CERTIFIED EXPERT
Top Expert 2016

Commented:

Author

Commented:
where does the properties file exist in the application?  

can you give a sample of a connection string inside this file?

Thanks
CERTIFIED EXPERT
Top Expert 2016
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Boy, I just don't think my brain is working today.

is a Properties file a Bean? servlet? xml? txt?  and where would it be stored in the application?
CERTIFIED EXPERT
Top Expert 2016

Commented:
Properties is a class in the API. It usually works with a file in the application, stored anywhere, but often in the classpath
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
you should define your database as a data source and specify the connection details in your apps context file and access it via jndi

Author

Commented:
thanks for you help
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
For others reading this the accepted solution is completely unnecessary, there is already a standard method for providing connection details. Nobody doing Java web development uses a separate properties file to store these details :)
CERTIFIED EXPERT
Top Expert 2016

Commented:
Is it for server side configuration?
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
thats not even relevant

Author

Commented:
So what is the standard method.?
I gave the point the to cehj as he did give me some pointers.  I actually am defining the string in a bean and then calling that.

Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.