• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC problem

 
kandula chandrasekhararao
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
may i know how to use properties file for connecting to a database?
Advanced thanks
 
Wayne L Johnson
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are lots of ways of doing this, but this may help you a bit.

This example uses the Oracle "thin" driver, but it should work for any database/driver combination. In your code you will need to read in the properties either as a "Properties" instance or "ResourceBundle" instance, and then get the values appropriately.
If you go the "Properties" route, this would work (shared for its functionality, not for style points):

There are several ways of reading in a properties file, this one being less elegant. If you are running in a Web environment I recommend that you use the "ResourceBundle" class.
Give it a try ...
[ September 04, 2003: Message edited by: Wayne L Johnson ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic