Problem with deploying an application that is using sql server 2008 express - sql-server

I've developed an application for my college project in Visual C# which uses SQL Server 2008 Express database. My application is desktop-based. But the problem now is deploying the application. Is it required that a SQL Server 2008 be installed on the client machine (with my tables and data inserted) or can I just have the .mdf file exported and everything works well?
Is there a way to escape the installation of SQL Server 2008 on the target machine?
Sorry, just found a duplicate: Does user need SQL 2008 Express Installed if I deploy app with .mdf file?

You can deploy SQL Server Express with your application. However, most of the time this is just the wrong thing to do. SQL Server Express is a server-class database, and likes to use up system resources as such. It also runs as service, which means it's using those resources even when your application isn't active.
Instead, you should choose a desktop (or in-process) class engine, like SQL Server Compact Edition, Sqlite, or even MS Access. In addition to being an all around better choice for your desktop program, these database will also generally be much easier to deploy.

Related

Deploying Windows application with SQL Server database

I have a WPF project and I will use SQL Server database. The instance of SQL Server IT created for me is SQL Server 13 (2016 standard version) on a remove server. When I’m deploying the application on a client’s computers, what version I need to install there as a prerequisite? Can I deploy SQL Server Express 2016 on a client’s computer and access the remove SQL Server Standard edition? I am looking for a simple solution and for a lighter version I need to install on the user’s computers. I cannot install a full SQL Server on each user.
I have searched the net and a similar question has been asked many times, but I didn’t find a clear answer before. Many people started their SQL Server experience using local type databases, like SQL Server CE or LocalDB. In this case specific DLLs and redistributables must be added with the installation program. It is hard to understand at the beginning, but when an instance of SQL Server is on a remote server, this is a different story. Everything is happening on this remote server. There is no need of any SQL Server instances on a client’s machine. Just a connection string must be added. The adapter or Entity Framework will take care of everything else.

which embedded db supports TSQL?

I have a spring batch application which reads data from SQL server. I would like to write an integration test against an embedded db which supports TSQL.
Exp: My main application has some queries which uses "for json path"
I am looking for an embedded db where I can test in memory.
PS: I tried H2 and looks like it does not support TSQL.
Please download this
https://www.microsoft.com/en-us/download/details.aspx?id=30709
Microsoft SQL Server Compact 4.0 is a free, embedded database that software developers can use for building ASP.NET websites and Windows desktop applications. SQL Server Compact 4.0 has a small footprint and supports private deployment of its binaries within the application folder, easy application development in Visual Studio and WebMatrix, and seamless migration of schema and data to SQL Server.
FYI -
Looks like Microsoft SQL Server JDBC Driver does not support connecting to SQL
Server Compact.
How to use SQL Server Compact Edition (CE) from Java?
https://social.msdn.microsoft.com/Forums/en-US/4d25a17f-6dda-4bec-8a92-f068594553ef/java-and-sql-server-compact-edition?forum=sqlce
Perhaps you can use SQL Server Express LocalDB.
I do not know about its technical details, however. I have personally not (yet) used it in a development project. Perhaps it cannot be considered to be an embedded database like SQL Server Compact Edition is. But a quick search on Internet does indicate that it could be accessed from/with Java.
Regarding managing LocalDB databases with SQL Server Management Studio... Contrary to what is stated in the official documentation, I did succeed to connect to LocalDB using SSMS (version 18.9.1). I only needed to enter (LocalDb)\MSSQLLocalDB as the server name in the connection dialog and use Windows Authentication.

Can a WPF app with .sdf database run on a computer without SQL Server installed

This question may seems a bit silly. The thing is I'm programming a WPF using VS2010, which contains a .sdf database (connection is ADO.NET).
Someone told me that if I use a SQL Server Express database it can be run on any PC even it has no SQL Server installed. But after I tried executing in my virtual machine (win7 & win xp), seems it cannot even start up.
So, can someone brief me, what database do people normally use in developing WPF software? Is it true that my program using a SQL Server database file cannot execute on PC without SQL Server installed?
Much appreciate in advance!
Yes, it can!
SQL Server Compact (that produces and uses .sdf) is the only SQL Server edition that does not require a server to be installed. All its code and logic is contained in the handful of DLL's that you need to include with your application. Just ship your app with those DLL's and you should be fine.
Read more about SQL Server Compact and how to use and deploy it on MSDN.
SQL Server Express (and any of the other editions, like Web, Standard, Developer, Enterprise) on the other hand does require an installation of the SQL Server Express edition - either on that machine, or somewhere in the network where your app runs (remote connections from the network are disabled by default, but can be enabled).

What version of SQL Server do I need to move database to production server?

I have just finished developing an ASP.NET on my local Windows XP machine. I used Visual Studio 2008 and SQL Server express to develop the site.
My problem is that now I would like to move the SQL Server database from my XP machine to my production server.
I have been reading that SQL Server express cannot export my database. Is this correct?
What would be the best way to export my SQL Server Express database so that I can deploy it on my production server.
IE Do I need to download and install the full blown version of SQL Server? If so what version would be best.
This is very frustating as I have added informaton already to the database and I do no twant to loose all this information if possible.
Any help would be greatly appreciated...
SQL Server Express will be just fine for this- it uses the same native file format as the more-expensive editions. All you need to do is detach the db file, copy it to production, attach the production server to the copied file, and you're good... well, mostly good. This won't cover certain things, like logins or maintenance jobs, but all the data, stored procedures, and indexes will be there.
What SQL Server Express will not do is export your database into a format like csv. And even that's not entirely true. It's just the express management studio that lacks the capability: IIRC if you connect the full edition of the sql server management studio to an express server db you can use the Export features.
Going a step further, if you really need to export data from management studio express you can still just set the query window to save query results to file and write a set of export queries.

How do you work with SQL Server CE and SQL Server 2008 Express?

I have installed:
Visual C# 2008 Express
Visual Web Developer 2008 Express
Visual Studio 2008
SQL Server 2008 Express
SQL Server Management Studio
In Visual C# 2008 Express, I can "Add Item" and create a "Local Database" (.sdf file) or a "Service Based Database" (.mdf file).
Visual Studio 2008 is the same as Visual C# 2008 for applications but in Websites, the only way I can create .sdf or .mdf files is via the Database Explorer.
In Visual Web Developer 2008 Express, however, I can "Add Item" and ONLY create a "SQL Server Database" (.mdf file). Even the Database Explorer doesn't offer to create a SQL CE database.
Questions:
why the discrepency between the applications, is this normal or did something go wrong with my installations?
I never "installed SQL CE", where did it come from and how is it that I am able to create .sdf file?
How do you work with these in projects on a day to day basis, do you use Visual Studio to edit the databases or do you use SQL Server Management Studio?
I believe only Professional and above may create MSSQL CE databases.
SQL CE is installed with 2008 studio, I was surprised to see it myself and didn't see an option to exclude it.
Personally I use VS 2008 to add items to my project databases. Since it's open anyway I just use it. It provides most of the same functionality as Management Studio. If I am doing separate database work, I usually do it in Management studio.
The CE databases are pretty useless. They have a limited sub-set of types and functions. They do not support views or stored procedures. Basically they only store tables; I haven't attempted to create foreign keys in them.
There is no way to rename tables or columns. You must create a new table.
Once you create your database it must be manually added to your project.
You cannot directly create a LINQ to SQL class in VS2008 on a CE database. You need to use the command line tool sqlmetal (called from .NET console) to create the class for you.
I've had issues where the Class created for a CE database didn't work like a class built for a regular SQL database. Because of this I abandoned using a CE database all together.
It would be nice if there was a reliable way to use Linq to SQL on SQLite databases. SQLite is a great self-contained database not requiring any type of external engine.
Sorry I don't have any performance statistics for an SQL CE database.
I hope this is somewhat helpful.
Brett
Ok registered now and not sure why got a -1 vote on previous answer but will expand.
Web Developer Express 2008 Does not create or work with Sql Server CE simply because SQL Server CE is not designed to work on the Web Server.
When you load c# express or vb express. sql server express 2008 is offered to be installed. SQL CE isn't installed. if you go and add a data source the two I know will be there, Microsoft SQL Server Compact 3.5 (.NET Framework Data Provider for Microsoft SQL Server Compact 3.5)and Microsoft SQL Server Database File (SqlClient), the access client may be there also.
It should be noted with a default Express setup that if you choose to use the data provider for sql server compact it will fail even though it is an option. you would have to download sql server ce separately to create sdf databases.
Also Express versions are targeted to a different audience and doesn't have the same ui setup as the main vs sku's have. For example Web express in database setup doesn't even offer the choice to use sql server ce. while in VS it is a choice from the data menu mainly because VS supports more than just web developer.
Now you said you loaded VS 2008 (didn't say what version but doesn't matter since this affects standard and above)
The default install for vs 2008 will install Sql server ce (and as previous answer stated 3.1 was with rtm, 3.5 was with sp1). you can turn it off in advance options.
One concern I have is that you mention that you can't create a database in vs on web projects. which template are you using. You should be able to create server based database Items in add item and both local and server database objects in the data tab.
so in Summery.
on client based express skus and client based projects you should be able to create a local or server based database from add item and from the data tab.
Since sql CE is not officially supported on the Web Server. on the web skus in add Item you should only have access to create a server based database. on express since it is a dedicated sku CE isn't an option in either the data tab or the add item. on vs you can create a CE database from the Data tab. and you should have access to create a server database in add item.
sql server management studio doesn't care where the source is. so it will work with all and create the database.
I use all the options listed just depending on what or where I am at the time. as was mentioned CE on the desktop is primarily a cache database perfect for offline database support. but does have its limitations and in addition really needs better integration. once I am created or working with a database in support I primarily use management studio.
The key point in why you can't access CE from Web express is that CE is not supported on the web server.
Douglas
This is normal. The database types supported by the Visual Studio designer differ by edition. Note that any version of Visual Studio can write and use code that connects to any of those databases. It's just that the visual "wizard" tools included with the IDE that walk you through it are different for each edition.
SQL CE is the Compact Edition of sql server. It's intended for use on portable devices like smart phones or as an Access replacement for a local data store in desktop apps. It's very portable: only 2 dlls that clock in at less than 1Mb of disk space, and was probably included with at least one of your Visual Studio packages, probably all of them.
I normally do all my database work from Management Studio, but that's a personal preference.
The discrepancy is odd, but since SQL CE is a plugged-in item, it may well be that the team didn't test every possible scenario and some of the applications simply didn't get the info they needed to know that it's there. I'm not saying that anything went wrong - it may simply be a scenario that the SQL CE team never tested.
SQL CE was installed with Studio (can't recall offhand, but I think 3.1 shipped with the RTM and 3.5 shipped with SP1).
I always use Management Studio for making database modifications (except those done directly in code).

Resources