Considerations for packaging MSDE app

P

Paul Aspinall

Hi
I have a C# Winform app which runs using SQL Server.

I want to package up the app, so that it deploys with MSDE.

Can anyone offer any pointers or references to help??

Thanks
 
S

STom

Hi Paul,

I hope my suggestions will help you, because I have gone through pure h#$l
getting this to work right.

I have a VB.Net winforms app and I use Wise Installation System to install
the .Net framework, MSDE, the app.

A couple of things tried and failed:
1. Within wise, we installed MSDE with the command line option where it sets
the password. We decided to install MSDE into its own instance becasue we
don't want anyone coming behind us and hosing it up by installing an
untested service pack or anything.
2. At the end of the install, we run a batch file to stop and restart the
SQL service. In retrospect, this may not be necessary because of our
decision to reboot before the app is executed the first time.
3. We attempted to run a batch file to attach the database, but no matter
what we tried, it just would not work. It didn't matter if we rebooted and
then ran the batch, nothing worked. So, I added the code to my app that does
this:
a. check to see if the SQL service is running, if its not, warn the user and
shut down the app.
b. if this is the first time the app is executed:
b1. check to see if the database exists, of course it does not, so using
ado.net, execute the command against the master database to attach the
database. Test again to make sure the database is attached, if not, throw an
exception.
b2. Update my configuration file to show that the app has successfully
initialized.
4. Now here's the real McKoy - in order to get all this to work the first
time I connect to the database to check the version I had to use
POOLING=False in the connection string. Problem: The app ran as slow as a
turtle because now it wasn't using connection pooling anywhere. Solution:
Two connection strings, one for initial startup (first time connection) then
one for the rest of the time (without POOLING=false)

5. Another issue came up of how we would update our database, we surely
didn't want to have to detach and then re-attach another database and blow
peoples data away, so I added a version table to the database and I run a
check on the current version each time the app is executed. If the versions
are the same, I don't execute the update executable. So you may ask, how do
you know if you have a new database version and an update needs to take
place? Answer: When a patch is applied (or an executable update) I have a
Version.xml file where we will put the new version number to be compared
against. The executable that runs the update is also new since it will have
code in it to do the update.

But, here's the big question, after you install MSDE, do you need to reboot
or not? The answer is that I was able to get my app to work without having
to reboot, but we have decided to require a reboot because I just believe
there are things in MSDE that need to be set correctly and I think rebooting
is the only way to do it. Again, my app works without it, but I just feel
like its more proper to reboot. I mean after all, you are installing the SQL
desktop engine which is no minor thing, not to mention the .Net framework
install.

Now, there are probably many MSDE experts out there reading my steps
thinking, man, he did this totally wrong, but I'm telling YOU these are
things you are in the end, probably going to have to do to (especially the
POOLING = False setting).

There are many things we haven't even gotten to yet like:
1. What happens if a person doesn't reboot the machine, how do you stop them
from running the app?
2. What if a person runs the install, uninstalls, then reinstalls and
reboots, how does that affect the app?
3. Do you want the uninstall to uninstall the .Net framework and MSDE? I
personally don't think so but then both these items are rather large.

Hope this helps.

STom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top