Store database information

bungpeng

Well-known member
Joined
Sep 10, 2002
Messages
906
Location
Malaysia
What is the best way (or recommended) to store my database information? like database IP, name (or even username and password)

Should I store in .ini file? registry? or what else?
 
Well I always store values such as User preferences e.t.c into the registry - this is what vb.net seems to prefer to use. But I wouldnt recommend you place passwords directly into the registry - what are you trying to do? save a connection string?
 
Registry? But for new installation, no value in registry, our need to manually add in?

I want to store database information.
 
I am presuming you are looking to store the location, and connection string into a central location. If i was going to use the registry I would set my installation program to create the registry keys with the paths to database, userid e.t.c and then have my application check the registry for these keys.

To add a registry key/value during install - select your setup project, on the menubar choose View --> Editor --> registry this will allow you to set keys to be created when your application is installed.
 
I wouldnt know in Visual Studio ASP.NET - sorry! Saying that I use Dreamweaver for classic ASP page creation and I would store the connection e.t.c. into an Include file and just include the include file on each page that required the code.
 
For information store in registry, if we want to change the location of the database, how do you going to change in registry? manually go to all workstation and change one by one?
 
To be totally honest I would never recommend you move the location of any dependant files.

If you must, you could have a text box somewhere in your application that reads the registry location of the database - amend this and then make it update the registry setting. I have never actually dealt with the possibility of moving a database within a networked application but I would imagine you would have to update each client application manually to read from the new location.
 
Reality shows, however, that files move, devices move, computers change their names, even whole companies. :-)


How about storing it in the app.config? Or web.config?
 
username and password hard coding in source? then if customer change password, we need to change our source?

For security reason, password should change from time to time
 
Back
Top