• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

I need an easy Database for my Windows Service


I have a small service which downloads mails, stores them and sends them (IMAP 2 SMTP).
These functions are from my first tests. Fast and dirty. But now I want to design them at all.

I need them to be stored in some kind of files. So the user can move them to an other machine easy.

So I have a email-account with about 3500 mails. Each 20-100k in size.

I download them to the local dir and create two files for each mail.
username@imap.provider.com-00001423.msg containing the email
username@imap.provider.com-00001423.inf containing infos about the mail and the handling

I need to delete the mails after 14 days. So I need to know which ones I allready downloaded, which not and which to delete.
For this I use a ini-file.

This file is about 300-400k in size.
Im not sure how clever GetPrivateProfileString or WritePrivateProfileString are.

I have a log file with about 30 - 100 MB per day (textfile).

Old Information will be deleted to save space.

So here we go.

a) how should I save the emails itself?
Everybody told me not to save binary data in a mailbox. But a dir with thousend of small files sounds not very good too.

b) which kind of database to use to stores the other information?

It must be:

- free of chargeto use in a comercial software
- easy to install
- capabil to defrag itself

Because the software will only costs about 50 Euro I cannot tell somebody to buy a MS SQL Server.
Allthough I cannot tell anybody to install MySQL itself.


But how to defrag. I tried to programmly defrag mdb files without success.
Is this possible with mysql?

How to access MySQL from a service?

  • 2
1 Solution
>>>> I cannot tell somebody to buy a MS SQL Server.
Did you try SQL server express edition?
AndyAinscowFreelance programmer / ConsultantCommented:
You could also consider a microsoft access database.  (Chances are you wouldn't need to even install anything - the ADO components you would require are parts of the operating system)
StefanKittelAuthor Commented:

a MySQL ofr MS SQL Server is a little bit heavy and could lead to many technical problem during installation I need to handle.

Acces sounds find. But how to shrink it? I delete often data so I need to shrink this file.
I could not find using google.

AndyAinscowFreelance programmer / ConsultantCommented:
The Jet engine exposes a CompactDatabase method
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now