Hiding Connection Settings

grip003

Regular
Joined
Sep 2, 2004
Messages
89
Location
North Carolina
I write a lot of database applications that connect to a MySQL database. I have a UserProfile class that stores the connection settings into this database as constants, which I know can't be very good. Is there a good way to store connection settings in a program?
 
You can store your connection string settings in an app.config file. That way if you ever have to change the settings, for whatever reason, you can do it wthout having to rebuild your solution. At least thats how I've done it in the past.
I hope that was helpful.
 
I looked into using the App.config file, which seems pretty easy. The only problem is that there is no security and someone can just open the file and look at the user name and password information for connecting to the database. Is there a more secure way?
 
Back
Top