Solved

Windows application using embedded database

Posted on 2009-07-05
4
362 Views
Last Modified: 2013-12-17
I have a small windows application that I needs to have an embedded database.  The database will maintain static data that will be used during the course of the application's use.  The database cannot be an external SQL server but rather an "embedded" resource installed with the application.  The data can be as large as 3 columns with 45,000 records all varchar.  What would the best case scenerio.
0
Comment
Question by:andy_ee
4 Comments
 
LVL 9

Expert Comment

by:Rahul Goel ITIL
ID: 24782415
If you have got this kind of requirement. then I wll ask you to use XML Files as a embedded files in the assembliese

Or

You can use mdb filea and embed that in assembly..and while using it you need to extract to some temp location and use it and delete it
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 24782433
this information will require about 0.5 - 1 Mb. This will inflate your application unless you store it compressed.
I think the best option is to save a deflated xml file as an embedded resource. Then inflate it at runtime into memory with an XmlReader or other classes to handle xml.
0
 
LVL 40

Accepted Solution

by:
mrjoltcola earned 500 total points
ID: 24782483
When you say the database cannot be an external SQL server, do you mean external as in running on a different machine or on the same machine?

You can package and distribute embedded databases such as iAnywhere (SQL Anywhere), SQL Server Compact Edition, SQL Lite, Perst, etc. all as part of your application. This is the most common way I distribute applications with data. However, most of my apps have many tables, not just one.

For a single table of data with 45,000 rows, you can get by with SQL Lite as a free option, it is part of your application, not an "external" server. Most all embedded databases are compiled in as part of the program.

I've also had success packaging a file as a simple fixed width record binary file, and loading in the index at runtime. There is no need to load the whole 45,000 records, you can simply load the key column, then randomly access the data file by index. Have used this technique with drug databases for example with about 80,000 rows.

XML is not the best solution if you want decent performance. If this is on a PC, I agree with loading into memory, but I would use a CSV format packaged with the app and load it completely into a Map or Hash object. Using CSV eases the maintenance of the file, you can use a standard database extract or use a spreadsheet. If it is a PDA or smaller memory device, I would probably not want to load the whole file in memory. Definitely not XML. XML will bloat the data storage, plus it does not solve the problem of random access. XML is not a database driver, it is simply a format. The advantage to using an embedded database is that it is stored in a B-Tree indexed format so there is no memory overhead at all.

0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 24783817
I would use http://www.microsoft.com/Sqlserver/2005/en/us/compact.aspx. Only 2 DLLs to copy with your application (no installation of SQL is required).
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question