Click here to Skip to main content
15,916,379 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have one windows form based application which has SQL Database.

SERVER Machine Has(Windows PC):Application & Database File & SQL Server
Client Machine Has:Only Application

Server Does:allows Remote connection to sql server
client Does:use application & connect with server database or sql server

i wants to create setting file & it will be used through network to connect sql sever via remote connection with TCP/IP

settings like sql server name,database file name,username password etc.

I know this can be done using:
1) Store setting file in server machine & share via netwrok
2) Newtwork Registry

which option is better for me & which is more reliable?

What I have tried:

currently i am trying to conncet to sql server via tcp/ip manually writing sever name & etc but i need setting file like server name database name etc.

I am installing application in each client and this application will conncet to server database which is stored in server machine.

Please Suggest one option.
Posted
Updated 12-Sep-17 18:29pm

1 solution

I'm not sure that storing a setting file with username and password on the network is a good idea. In overall you should avoid hard coded, shared user accounts in a client server environment.

If you store the password in a file, even encrypted, you need to be able to decrypt it in order to use it. Basically this means that anyone who has access to the file can also figure out the password

When connecting to SQL Server you have two options:
- If you use SQL Server authentication, you can ask the user name and the password from the end user.
- Preferably use Windows authentication so that the AD takes care of the actual user identification.
 
Share this answer
 
Comments
[no name] 13-Sep-17 0:53am    
hello sir
i want this file for sql conncetion string so if i change file i will reflect to all machines apllication conncetion string
Wendelius 13-Sep-17 0:57am    
As far as I can see the easiest way would be to put the server name and the instance and the database name to a file in a network share. You can use whatever format you like, personally I'd use XML because it's easy to read and serialize/deserialize.

However, my point is, do not store the whole connection string in this file. Leave out the username and the password.
[no name] 13-Sep-17 1:08am    
ok. Thank You. I accept your Solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900