Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DriverManager.getConnection

 
Vidya pr
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Could anybody help me out with this
con = DriverManager.getConnection(url,User,Pass);
ie.. instead of giving username and Password i wish to globalise the variables so that i can connect to various databases just by changing a single variable but its not working.
I wud b thankful if anybody cud help me with this .
regards
Vidya
 
Shiv Sidhaarth
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am not getting ur question clearly. You can keep your URL, username and encrypted password in a text file. Then, read them thru ur appln and use them to connect to different database (Provided driver is same for diff. databases). If u have diff. driver, then include driver class name also in the text file. Hence, whenever u want to change datbase, u just need to change the text file. Is this, u wanted?
-Sankar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic