Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
See more:
Hello, I have some questions about best practices and way when creating application with database, some of these questions may look stupid but I need to get the ideas:

1. when I create application with database and after deploying it, when I install it on new PC what must be on the the new PC to work normally on it?

2. If it is not deployed, how to solve the problem of installing SQL Server and making database installed while installing the program?

3. when I create application with database did the database deployed with the application?

4. while I am creating the application, if I use the connection string it will have static information, but this info will be different on the other PC, right? If yes, how to solve this problem?

5. How can I check the database existence and connection when I starting up my program?

6. How to secure information saved in class where they are not accessible easily?
Posted
Comments
Sascha Lefèvre 1-Apr-15 19:36pm    
Good questions! Maybe you should explain 3 and 6 a bit more.
3: Do you mean how you can deploy a prepared database along with your application?
6: What information exactly do you want to secure? The connection string? And why?
Hassan Dbouk 1-Apr-15 19:41pm    
you are right about number 3, but what I mean in 6 like if I have register code information and things like that I want to keep them private?
Sascha Lefèvre 1-Apr-15 20:01pm    
You mean license activation data, right? If you're serious about protecting your software installations with license activation you absolutely should go for a professional commercial solution (about $200 and up). And then there will be documentation on how you incorporate that into your application.

1 solution

1. Minimum is application exe file and the database (assuming you're setting up local database and not accessing shared one on the server. Commonly, you will have additional dlls and config files.

2. There are installer packages that can take care of that. Google around and you'll find some solution. Visual studio has rudimentary setup project template.

3. Database deployment: commonly via scripts prepared if they are parts of setup package. If you're setting it up manually, fastest way is to have a backup copy of empty database (with all relevant information in, such as lookups) and simply restore it to new installation

4. No, it doesn't have to be different. You can reference local database with localhost or ".".

5. Try to connect and check the resultant exception. You could for example have license retrieval and/or program version in a small table. The result of the query will be a) no connection or b) information to check for validity.

6. You could save critical information into the database encrypted. You could even save it in a config file, but it would be easier to get (but not to crack). Or you could have your own server and require internet access for license validation (in which case no one without internet access could use your program until checked). Good design would allow for some time without checking after first check or even allow for single check.
 
Share this answer
 
Comments
Hassan Dbouk 2-Apr-15 18:45pm    
Thanks a lot that was helpful, but what to do if I am not using local database and I am using SQL server? So the database is not deployed right? And how to deal with the connection string?
Sinisa Hajnal 3-Apr-15 2:21am    
If you're not using local database then you shouldn't have any problems whatsoever. You install the database at some server you control and give access to your users. That's all. If the users themselves control the server where the database is then give their IT your scripts along with requirements and let them sort it out.

Maybe it is a terminology problem. SQL server CAN be local database as can access, oracle and others. Local database simply means the database installed on the computer as opposed to some outside server. So, if you're installing the database along with the application on the computer where the application will run, that is local.

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