Solved

Windows application using embedded database

Posted on 2009-07-05
4
366 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 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