views:

1035

answers:

6

I'm starting up a new web application. It's going to be hosted on a service that charges extra for SQL Server and frankly I don't think the site needs that much of a database. Right now the data model is 5 tables. And I'll be amazed if the largest table ever goes of 10k records.

So I'd like to keep the db lightweight. SQLite piqued my interest originally because I need to learn it for Android. But the lack of foreign keys makes me cringe. Sure it's possible to implement something that looks like foreign key constraints but it just feels un-relational. Firebird seems like the only lightweight (and free) db that supports FKs.

Also, I'd really like to get my feet wet in LINQ with this project. So far I've only found dbLINQ that lets me use SQLite or Firebird with LINQ. It's currently at v0.18 so it's far from primetime. I've run the tests for SQLite with dbLinq and they pass for what I need.

There was one other implementation of LINQ for SQLite but all the links I've found for it end up in 404s.

So what are my options for lightweight databases that are compatible with LINQ? Any of the compact editions of SQL Server are out, unless there's one that's XCOPY deployable with no install of an agent/service? I can't be asking the host to install new software since I doubt they'll do it and I want the app to be highly portable (with respect to hosting).

The list so far:

  • SQLite
  • Firebird
  • SQL Server Compact
  • VistaDB

Update: I tried out all of the versions and wrote up my impressions here. The short version: SQLite wins hands down. It's the only one that has a good GUI, no install footprint and is free.

+2  A: 

SQL Server Express

Dan
Same here - it's free and stomps!
Pure.Krome
"It's going to be hosted on a service that charges extra for SQL Server". It's probably a web-hotell and not deddi / colo.
Filip Ekberg
SQL Server Express is on the list, but it's conditional; the host I'm looking at has some hoops to jump through to get it going.
jcollum
No, pretty sure this one won't work, since it requires an install. I'd prefer to be able to get my db on and off the server without having to talk to tech support, which I think is reasonable given the parameters of the question.
jcollum
I think he may have meant to say Sql Server compact.
masfenix
It is free, but not for web facing deployments - read the EULA.
Jason Short
+3  A: 

SQL Server Compact Edition (http://en.wikipedia.org/wiki/SQLCE) supports LINQ and all the other VS tools, is built into VS 2008, supports FKs, and is XCOPY deployable with a flat-file for a database. Be warned though, that it's not without its caveats as well, a lot of things like views or nested queries fall over, and it can be pretty bloated if you start getting the database size pretty big (i.e. 50MB+).

SQLite is also much better if you use the SQLite .NET provider here (http://sqlite.phxsoftware.com/), works with LINQ as well, and has basic VS support.

Paul Betts
+3  A: 

I would suggest you have a look at VistaDB. It'll do exactly what you're looking for with the additional benefit over SQLCE and SQLite that it supports views, stored procedures and triggers. As a matter of fact it supports writing of procedures and triggers in TSQL as well as .NET so you can leverage your SQL Server AND your .NET knowledge.

Conrad
SQLite supports views and triggers. Sp's aren't important because I'll be using LINQ. And VistaDB is damn expensive, it totals up to almost 3 years of SQL Server in a shared host environment.
jcollum
@jcollum: but VistaDB is 100% managed code so it can be truly used on any shared webhosting package. SQLite requires full-trust.
lubos hasko
3 Years shared SQL Server rental = you own nothing and get to store what 250MB of total database? VistaDB is cheap considering a single SQL Server install is > $750. Rented SQL Server means you get nothing.
Jason Short
+3  A: 

You can use LINQtoSQL as is on an existing database, so long as you can make a standard IDbConnection object.

Here's some code to use LINQ on a Firebird db.

DbProviderFactory dbProvider = DbProviderFactories
    .GetFactory("FirebirdSql.Data.FirebirdClient");

DbConnection connection = dbProvider.CreateConnection();
connection.ConnectionString = "some connection string";

DataContext linqContext = new DataContext(connection);

var query = from something in linqContext.GetTable<SomeType>() 
            select something.someproperty;
Cameron MacFarland
Interesting, I'll give that a shot.
jcollum
How would you generate the .dbml metadata needed to query the Firebird database?
dthrasher
+3  A: 

SQLite. Has a good GUI (with auto-freakin-complete no less), has no install footprint, is free and will work regardless of where I host the website. I know I'm answering my own question, but no one else put just SQLite in their reply.

Important: SQLite will require a web host that uses Full-Trust mode if you want to run it on shared hosting.

jcollum
SQLite requires full-trust because it's unmanaged code. Shared webhosting usually does only medium-trust for security reason. you can have your website transfered to full-trust server but then your scripts and database are visible to other clients who share the same server.
lubos hasko
I'm told that the target host for my app does allow Full Trust. I'll have to look into it, but thanks for bringing it up.
jcollum
jcollum
+2  A: 

VistaDB is the only alternative if you going to run your website at shared hosting (almost all of them won't let you run your websites under Full Trust mode) and also if you need simple x-copy deployment enabled website.

Koistya Navin