I am trying to understand the concept of creating a program that uses a SQL Server database, but I only use it on my local machine
How can I get the program to use a SQL Server database and work with it on whatever machine it is installed on.
If you came across my line of questions today, you would know that I am doing free source code and a free Desk Desk for small and medium businesses.
-
Client application. The client application is a Windows Forms application. When installed and run for the first time on each client computer, it prompts for the address of the main Help Server server.
-
Server. This is where I plan to handle all incoming help requests, show them to the IT guys, and provide WCF services for the client application to use.
My dilemma is that I know how to make a program run on my local machine ; but i am very obsessed with how to make this work for anyone looking to download and install the server bit on their windows server.
Do I have to make SQL Script and run it on MS SQL Server when user wants to install "server" application?
Thank you very much everyone for your precious time and effort to teach me. This is really really appreciated. :)
Edit: To clarify, each business will have their own server completely separate from me. I will not have any access to them, and they will not be associated with me in any way. (I don't know why I should clarify this: P)
So, if you have installed FREE NO DATABASE SERVER ; What can I do?
Okay, the part of the answer related to the SQL Server database (and frankly, SQL Server Express will go a long way - 4GB of data) and server setup items.
First, make the SQL SEP install, make it a prerequisite, maybe tweak your installers to test (challenge) but essentially point them to SQL Server express links and let them work with it).
Second, separate installers, as suggested, for your client and your server items.
Finally, how to create the database - I would suggest using code to create and maintain (update) the schema, i.e. when you have a connection to the server, you can run the code that calls the DDL that does what is needed (something like here: How to create an "embedded" SQL 2008 database file if it doesn't exist?
Question: Are you going to use all messages from clients to get through your WCF service?
a source to share
Your installation application should:
-
Retrieve the SQL Server name, username (with appropriate rights to create the database) and password.
-
Either run SQL scripts using a locally installed command line tool, or from code using SMO (for example), with a user-supplied server with the provided credentials.
By the way, before spending your efforts on creating an open source help desk, did you check what is already available ? Also, the open source helpdesk
a source to share
Do you need one instance of SQL Server on your machine or one on each of your clients' servers? If it's the latter, you'll want to install an instance of SQL Server - anything from free, but limited, and non-open source SQL Server Express to a more expensive SKU - on each server. This step can be included in the server installation package ; MSI installations make it easy to build MSSQL.
Then you will need to delete the schema, and possibly the data, in the instance. You can do this as a step in your installer or as part of your app's installation process. It may be possible that the server may already have an instance of SQL Server or more than one installed and your post-installation step should allow the user to specify which instance to install your snippets.
Then include the database configuration component in the client application. Ask the user - or grab a configuration file during client installation to allow unattended or unmanaged client installation - for server connection information such as server name and authentication information.
Authentication word - since you appear to be building Windows based tools, use Windows built-in (domain-driven) authentication if possible. Don't get into the process of storing logins, but instead rely on your existing domain to manage logins. It is a good strategy to use active directory groups to control access. Grant access to a specific group in SQL Server and defer group membership directly to Active Directory. If you can't get the access you need to do this, grant permissions to the AD accounts themselves. Avoid creating SQL Server accounts that open the door to some potential security issues.
a source to share
It is not easy to deploy a client / server solution with automatic installation.
You would probably be better off deploying a server installation along with a database engine and the skeleton database is already configured as you wish. This is done in order to avoid undue interference with the existing server - who knows what's on it.
Also you say you want to install WCF services and that probably means installing them on the client server, in theory this shouldn't be a problem, but in fact it might be, depending on what was previously on the server.
a source to share
I understand what you are trying to do. If I were you, I would do the following:
- Provide 2 downloads - 1 for the client and 1 for the server.
- Forget MS SQL Server and maybe visit MySQL as it really is open source. You can probably manage to use MS SQL Server Express Edition, but if your dataset gets gigantic (which is typical for helpdesk databases), you would be stuck.
- As other people have pointed out, on first launch (or during installation) I would have a client app to find the server.
a source to share