I want to deploy a project which is coded in C# with SQL Server as the database server.
I have to deploy the project where there is no SQL Server installed.
Anybody have any idea about how this can be done?
Thanks.
A full SQL Server install is probably not something you should even try to deploy - licensing aside, the configuration of a SQL server is environment dependent. It would be better to list sql server as a pre-requisite in documentation only, and get it installed manually.
If your database is smaller, though, a SQL server express install might be reasonable to embed in an installer (if you use a named instance); IIRC the larger version of the installer allows you to create a custom installer for an application, ideal for deployment scenarios.
Even better; if you can fit into SQL server compact, then that is an embedded server; there is no install as such - just ship the runtime with the application.
Related
I wrote a small app to learn more about SQL and experiment with Entity Framework. On first execution, my app creates the database locally, and after that opens the existing database. So far, so good - it works pretty well on my laptop, which has SQL Server 2017 installed.
I tried copying the assemblies to my desktop machine and that also worked as expected, though SQL Server was not installed.
But when I tried copying the assemblies to another laptop, the app would not run. The exception I saw was:
A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The Server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: SQL
Network Interfaces, error: 52 - Unable to locate a local Database
Runtime Installation. Verify SQL Server Express is properly installed
and that the Local Database Runtime feature is enabled.)
All machines are Windows 10. (Is it significant that the desktop machine has Visual Studio 2019 installed?)
I can't seem to find a post here which speaks to my problem. (I'm probably not phrasing my query well...)
Anyway, I don't want other users to be required to install SQL Server (Express, or otherwise). What do I need to include in my installation?
Can it be done more-or-less automatically by using ClickOnce deployment (a.k.a. Publishing Wizard)? Or do I need to build an .msi with Wix code?
Is SQLite a better option for this? Users of my app will not be sharing databases; each will have their own.
I have seen mention of SQL Server Compact Edition in this post: ASP.NET MVC - Switching from SQL Server Express to Compact Edition - Connection Issue, but when I tried to run this down, it seemed like this is no longer available from Microsoft. And I believe I'm already using SQL Server Express (looks like this is confirmed by the error message, above)...
At present I have worked around this problem by using ClickOnce deployment. In the near term, I would like to change the installation to include the dependencies (.NET & SQL runtimes) in the setup package, rather than downloading them at install-time.
But I wonder if SQLite would be a better long-term solution... One thing I have appreciated about SQLServer is that I can use SQLServer Management Studio to get at the database apart from the app, so I can validate what the app has done. I also think this is a good thing for users, as they will always have a second option for getting their data, if something goes wrong with the app.
Does SQLite provide any tool similar to SQLServer Management Studio for accessing the database?
SQLite is a better option as it is an embedded database. This means that it is a part of your application and doesn't require additional setup. It works well for storing per-user data that is not shared.
https://www.sqlite.org/whentouse.html
SQLite only requires its assemblies for deployment.
SQLite deployment for .net application
I created a c# program which relies solely on .NET and SQL Server. What do the end-users need to install in order to use my program? I know they have to install .NET Framework but I'm unsure if the program will work without the appropriate SQL files. or am I wrong?
I'm sorry if this question is rather misguided but this is my first program.
If your application is using SQL Server you will need to install SQL Server AND the database your application is looking for.
.NET Framework does not include SQL Server but SQL Server will install the .NET Framework. (SQL Server 2016 installation)
SQL Server 2016 Express had a LocalDB version that may suit your needs. LocalDB is a lightweight version of Express that has all its programmability features yet runs in user mode and has a fast, zero-configuration installation.
Good luck with your first program. :-)
I have got a C# .NET application which uses an SQL Server 2008 R2 database.
I have no problem deploying the actual application to multiple PCs, however I am having a whole world of trouble deploying the database. The application is going to be used by a large amount of users - it can be downloaded and installed by anyone. My problem is that the application uses a connection string to connect to the database.
How am I going to include the database as part of the installation using the Visual Studio publish tool, and make sure that it will work on any installation with the same connection string.
I have spent a long time searching, and have tried out many potential solutions, including this, however in the latter particular case, the application could not find the database when it was deployed.
As per your given SQL connection, it seems your are using Sql Server Express edition, to bundle express edition with your application, here are the options,
Add SQL Server Expression edition setup in your installation media, and invoke setup.exe through your setup program
Or you can use Web Platform Installer
Or you can simply check in your setup program, whether desired SQL Server Express Edition is installed, if NOT then display the message to user that "Please install the Sql Server Express Edition", and guide how he/she can install, for example providing a download link
Or you can go with Sql Server Compact Edition which is a light weight version and I think only few DLLs are required to make it functional on end user's PC.
For more information:
Sql Server Express Edition:
http://blogs.msdn.com/b/user_ed/archive/2012/12/09/how-to-embed-sql-server-express-in-an-application.aspx
Sql Server Compact Edition:
https://msdn.microsoft.com/en-us/library/aa983326(v=vs.140).aspx
We plan on pushing a windows application on computers external from our companies network (in various locations). I'm wondering what options I have for databases. I'd like to use SQL Server, but is there a way to avoid paying for licenses for each PC we load the windows application on?
Also, is there a way to have the data part of the executable when deploying the application, or would I need to install SQL Server on each machine?
Thanks!
As an alternative and a bit newer technology to Sql Server Compact Edition, you could use LocalDB.
Both are MS SQL products, but LocalDB doesn't have the disadvantages of CE, is still a file based DB and doesn't require the server installation, configuration and maintenance of SqlServer Express, only the runtime components.
Here you can find a nice comparison between Express, Compact and LocalDB
and here you can find the introduction of LocalDB by Microsoft.
The licensing of LocalDB is the same as for SqlExpress and you also need an installer to run for the runtime components of LocalDB (which is one downside when compared to CE).
Is there a way to avoid paying for licenses for each PC we load the windows application on?
Presumably you're just accessing a local database on these machines right? In that case you can use SQL Server Compact. It's free and pretty darn good.
Is there a way to have the data part of the executable when deploying the application?
If you're deploying your application via ClickOnce, then you can set SQL Server Compact as a prerequisite so the application will check for its presence and install it if needed.
Otherwise, you can push it out like any other prerequisite as part of the installer package (i.e. InstallShield or WiX).
i have a winform application in c#on visual studio, connected to a database in sql server 2008 and i have done a deployment to it so to use it i must install the sql server management studio and restore the database backup, so Can i when doing the deployment and setup project include or take the database backup to not need to install the SQL server management studio on the PC use this application and from the application i will take a backup from the updated database which has new records
So how do i make a deployment and setup project and embedded in it the database used so i'll not be needed to install the sql server in the PC which act as a server and the clients PCs as i want to use the application in a network?
If your database is trivial, should be accessible from a single computer and is used to store local data look to the.
http://www.microsoft.com/sqlserver/2008/en/us/compact.aspx. For sure you will need to read additional articles about how to use it and deploy it, but this should be a starting point. NOTE: you will not have stored procedures and advanced SQL Server features, but you will use the same code as you do now.
Note that if you want to restored a database from backup to an arbitrary SQL Server instance, you may encounter problems if the instance to which the backup is being restored is configured with options different than the original SQL Server instance (e.g., collation sequence, case-sensitivity, ANSI settings, etc.) If the default collation sequence is different, you may have problems with indices, for instance.
You can use sqlcmd for that, it installs with MSSQL server on client machine look here for details.
After you created bat file, you can run it from code use Process.Start
It's not the SQL Management Studio that is needed to be installed to make the program work, it's SQLServer that must be installed.
For small applications it maybe to much of work to administrate a SQLServer, in that case its better to use other database types... I used to use XML files, lately I use Sqlite, its very good no installation required. and it integrates great into Visual Studio.
Edit: If you only need to restore a .bak you could use that http://sqlbackupandftp.com/restore/ its very nice and easy, and its a very small file.