5

I have deployed plenty of software to my clients. Mostly are Window Forms applications. Here is my current practice.

  1. Manually install SQLExpress and SQL Management Studio to each client PC.
  2. Then use ClickOne to install the code from the server.
  3. When there is a changes in code, I will use ClickOne to deploy -(NO PROBLEM with this step)
  4. But when there is a change in a database column, what do I do?

I have even tried writing a database update script. Each time the program starts, it will read through the .sql update file and run them if the database exists. This solves the problem of updating the database columns, but it does not help in my DEBUGGING work when my customer complain there is a wrong data. At that point, I have to personally go to their site to check it out.

I find it difficult to have the database installed on the client PC as it make my debugging work very very difficult. I am thinking about moving my client database to a host on an Online server. But that then comes with these constraints:

  1. What if the internet is down?
  2. What if my customer has no internet?

Could you help to advise me? Is this a common problem faced by developer? What is the common practice out there? Does Window Azure or SQL CE help?

IAmTimCorey
  • 16,412
  • 5
  • 39
  • 75
VeecoTech
  • 2,073
  • 8
  • 37
  • 49
  • 1
    It depends a lot on what the application is. Are your clients ok with storing the DB offsite? There's latency issues involved. Where are you going to store the databases. What is "huuu"? – Stealth Rabbi Jun 07 '11 at 14:50

3 Answers3

1

Installing one database per client PC can be tricky. I think you have a decent handle on how to deal with the issue currently. It seems like the real issue you are currently facing is debugging. To deal with this, there are a couple ways you could go:

  1. Have the customer upload their copy of the database back to you. This would provide you with the data they have and you could use it with a debug copy of your code to identify the issues. The downside is that if the database is large it might be an issue transferring it.
  2. Remote onto the customer's machine. Observe the system remotely using something like CoPilot. That way you could see what is happening in its natural environment.

There are probably other ways, but these are a couple of good ones. As for using an online database, this is an option but it brings its own set of issues with it. You mentioned a couple. As for Azure, that is cloud-based (online) so the same issues will apply. SQL CE won't help you any more than your current installation does.

Bottom line is that I would recommend you look into the ways to fix your one issue (as listed above) instead of creating a whole new set of issues by moving to an Internet-based solution. I would only recommend moving to the Internet if it was addressing a larger business need (for example, mobility). Doing the same thing you have been doing only online will probably just make life harder.

To recap the comments below since they are so pertinent to the issue, if you are choosing between file-based databases that don't need to be physically installed on the machine, your best choices are probably between SQLite and SQL CE. Microsoft supports SQL CE better but it is a larger package and has less features than the trim SQLite. Here is a good discussion on the differences:

https://stackoverflow.com/questions/2278104/sql-ce-sqlite-what-are-the-differences-between-them

However, the issue gets more complicated when you start looking at linq2sql since that is designed for SQL server. Microsoft does not support SQL CE with linq2sql out of the box, although there is a work-around that will get it to work:

http://pietschsoft.com/post/2009/01/Using-LINQ-to-SQL-with-SQL-Server-Compact-Edition.aspx

SQLite is not supported at all with linq2sql but there is a way to use linq to talk with SQLite:

LINQ with SQLite (linqtosql)

This library also supports other common databases including MySQL and Firebird.

Community
  • 1
  • 1
IAmTimCorey
  • 16,412
  • 5
  • 39
  • 75
  • @BiggsTRC: Thank you for agree with my methods. i think SQL CE might do a little bit of work of help as when i need to deploy my software to my client outside of my country. I might required to travel to specific country just to install the SQL Express and Studio if following my steps above which i find not very feasible. Could you correct me if my point is wrong. – VeecoTech Jun 08 '11 at 00:38
  • Ahh, I see. You want to use a file-based SQL instance in order to get around the idea of installing SQL Express. In that case, yes, that would work. You could also look at SQLite to do the same thing. – IAmTimCorey Jun 08 '11 at 01:19
  • @BiggsTRC: comparing SQL CE and SQLite, which one would you think the best? To me, it seems like the SQLite is storing at client site, and client would required to send me the database if i need it for debugging. – VeecoTech Jun 08 '11 at 01:42
  • 1
    Either one will require your customers to send you the database file. However, you will probably do better with SQLite. It has some nicer features and it is cross-platform in case you ever go that direction. It is also a lighter install. Here is a fairly good set of SO answers to this issue: http://stackoverflow.com/questions/2278104/sql-ce-sqlite-what-are-the-differences-between-them – IAmTimCorey Jun 08 '11 at 01:48
  • @BiggsTRC: Thanks alot, that link really helpful. I would go for SQLite. ok if my purpose is to create a retailer POS, which i think the data storage would not be that much... i think only.. Do u think is good for me to go for SQLite? I have been using LinqtoSql for my apps. Does sqlLite support LinqToSql? – VeecoTech Jun 08 '11 at 02:22
  • 1
    linq2sql throws a new wrinkle in things. Neither is supported out of the box (CE or Lite). However, SQLCE can be made to work using a work-around: http://pietschsoft.com/post/2009/01/Using-LINQ-to-SQL-with-SQL-Server-Compact-Edition.aspx As for SQLite, you can use a library to use linq with that: http://stackoverflow.com/questions/250071/linq-with-sqlite-linqtosql – IAmTimCorey Jun 08 '11 at 02:28
  • I added this information to my post, since I think it is pertinent to the question and I don't want anyone else to miss it. – IAmTimCorey Jun 08 '11 at 02:35
  • @BiggsTRC: ok..sound good. Can SQLite handle multiple transaction simultanuously? – VeecoTech Jun 08 '11 at 06:22
  • @BiggsTRC: I read through this "SQLCE 4 Community Technology Preview is out. It supports multi user scenario and access from multiple threads of the same process." Does this meant i can use sqlCE for handling multiple user? e.g. 1 database(SQLCE) links with multiple computer with same applicaiton – VeecoTech Jun 08 '11 at 08:46
  • But the more i read about SQLCE4, many complain it has the problem with the speed. it is extremely slow in transaction. is anyone agree? Can any comment on this? – VeecoTech Jun 09 '11 at 00:24
1

Depending on the data I would recommend using SQL CE. If the data isn't too much, speed is not the primary goal (CE is slower than Express) and you don't need DB-Features not supported by CE (e.g. stored procedures) it is the better choice IMHO, because:

  • The client does not need to install a full SQL server (easier installation/deployment)
  • You do not have problems with multiple SQLExpress instances
  • Your SW doesn't need to worry if there even is a SQL instance
  • Less resources used on the client side

Additionally the clients could send you their SQL CE DB-File for inspection and you do not need to go to their site.

It is also relativly easy to implement an off site sync with SQL CE and MS Sync FW.

Christoph Fink
  • 22,727
  • 9
  • 68
  • 113
  • THanks for the reply. Do u meant SQL CE does not support stored procedures? Yes, indeed my software isn't having too much data and speed not really a primary goal. I am doing a retailer pos system. IF for running on SQL CE, then i would required a SQL Server and have my code written to be utilised with SQL CE. Whenver the internet is offline, it will store in SQL CE in client pc. When the internet is back online, it will then push to the SQL Server? Is this the right statement? Any good example how i can link my code with SQL CE? Thanks – VeecoTech Jun 08 '11 at 00:34
  • @belinq: SQL CE does not support Stored Procedures, you eigther need to run the queries one by one or do the logic in your code. The basic SQL from SQL Express should also work with CE, so just download SQL CE and try it. If you choose to use SQL CE I would use it as the primary data source and only sync/copy/send it off site when needed. – Christoph Fink Jun 08 '11 at 06:39
  • HI do u meant i should still be using the normal sql server from hosting server as the primary database connecting to my winForm apps? and using SQL CE only when it is in offline mode to store the data? Then sync the data back to SQL Server when it is back online? – VeecoTech Jun 08 '11 at 08:06
  • @belinq: I don't know how your application works exactly, but I meant it the other way around: Use SQL CE as your primary data source and only sync it to the SQL Server when needed/requested... – Christoph Fink Jun 10 '11 at 12:36
0

You could use the SQLCMD utility to execute the change script, as mentioned in this related question

Community
  • 1
  • 1
jao
  • 18,273
  • 15
  • 63
  • 96