How would I create a Database Application without the end user having to install a Database Server


I'm looking to develop a very simple database application that will need to read and write data to maybe 3 or 4 tables. I have SQL Server Express 2008 installed on my dev pc, and will be coding in VS2008 / C#.

I'd like to be able to deploy my application with a simple setup file (exe / msi) and have the end user simply install it and go. I'm looking at ideas on how I would go about creating / shipping the actual datasource. Every thing I search for online regarding database and visual studio ALWAYS talks about installing SQL Server (CE / Express / Full etc.), but I'd rather not have to ask the users of my application to install a separate program.

Not really looking for specific answers here, just a few general ideas on how to create and ship a database application without the user having to install a database server.


LVL 51
Chris StanyonWebDevAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Might be worth looking at either:

SQL Server Compact

or SQLite

Your basically looking for a self contained / serverless database

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I would suggest you use SQLite. It has a module which is supported by the community. Then, when you ship your program you would either ship it with an empty .sqlite database or have the program to create one upon first launch. The latter option will require you to run a couple of "CREATE TABLE" commands from within the application itself. I actually prefer the latter option as it allows you to add/modify the tables should your new software updates require database changes.
You can also look at SQL Server LocalDB:

Was designed to do pretty much what you're asking for, with all of the same T-SQL commands / syntax as Express.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

PortletPaulEE Topic AdvisorCommented:
If the application is very simple as you describe then SQLite may be all you need. There is more overhead in other suggestions (all of which are relevant though, I am late to the party it seems).

A disadvantage of SQLite is that isn't full T-SQL compatible and there are some restrictions (e.g. no RIGHT OUTER JOIN) that may not be familiar to you. It is very actively supported and extremely commonly used for the type of deployment you describe.
Chris StanyonWebDevAuthor Commented:
Thanks guys,

Very quick response and some good pointers. I'm going take a little time to read through the links you've provided and may be back with a follow up question or two.

Bear with me while I get my head around the various options.
Although I like sqlite because it is compact, it is still one more thing to package into your application. Remember that if you are using .net, you can use datatables upon which you can execute most queries that you will need. If all you want to do is look up data for the user, this is the cleanest solution.

If the user will be updating the data, you will have to persist it between executions. For that, you could write an XML file (as in WriteXml("XMLFile.xml")) or you could simply add it to my.settings
Chris StanyonWebDevAuthor Commented:
Thanks everyone. All excellent suggestions that give me enough options and plenty of reading  to do.

Initial thoughts are that a SQL Compact DB file seems ideal. Some of the development I do is also for handheld mobile devices running Windows CE, and it seems suited to that side of things as well - so one solution seems to cover both platforms.

SQLite also seems like a viable option for both platforms, so will definitely look into that. At the moment, the app I'm working on isn't particularly complex, so limitations in SQLite may not be a problem, although trying to guess the future and keep things scalable may play a part in my decision.

The SQL Server LocalDB seems to be a newer format introduced in later version of VS - I'm using 2008, so doesn't look like an option.

I did originally consider text files for the data (aka XML), and may still look at that as an option - be interesting to know how XML as a datasource performs against a 'traditional' database setup.

All valid responses, so I'm going to share the points evenly
Chris StanyonWebDevAuthor Commented:
EE does it again :)

Thanks everyone
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.