SQL Server Express / MS Access LINQ Features, Which One to Use? - c#

I have a few ASP.Net database front-end websites where MS Access is the back-end. I am trying to use ASP.Net dynamic data website. Should I change this database to SQL Server Express or something else to make it easier or should this work from with MS Access.

Pick SQL Express for these reasons:
Scaling: MS Access will never scale. Once you get over about 10 concurrent connections you will start to see trouble. SQL Express will scale. You can always move SQL Express up to a full-blow SQL Server installation. While this is somewhat true of Access, some of your SQL statements and data types may not transfer cleanly.
Security: SQL Server has a much better security model than Access. You can lock down the schema in your db per user. You can also better administrate user access (think dev user vs test user vs production user).
Performance: This is similar to scaling. If you see a traffic spike to your web site, Access may not handle it while SQL Server Express probably will.
Tools: Tools and libraries like LINQ are always going to be targeted at SQL Server. You will get better support and better documentation using them this way.

A Jet back end will work fine for mostly read-only websites, even ones with decent traffic. Michael Kaplan's old website, http://trigeminal.com, uses a Jet database as the back end, and back when it was his primary site (he's since been hired by Microsoft), he said it was getting over 100K hits per day, and was holding up just fine.
For read/write operations, Jet will begin to bog down on a website about the same place it would bog down in a multi-user LAN application, at somewhere between 20 and 50 simultaneous connections, depending on your app's design.
For what it's worth, even though I'm a professional Access developer and know Jet very, very well, I don't use Jet as a back end for any of my websites. That's not so much because I don't like Jet for websites, but because I don't like Windows for a web server -- I'm an Apache supporter (and PHP developer), and host all my websites (and my clients' as well) on non-Windows hosting services (presently all of them are Linux, but that wasn't always the case). All the website databases I have ever done use MySQL for the back end.
In short, find out what your host offers in terms of database back ends and choose the best one. I can't imagine a host that provides ASP.NET that would not offer SQL Server, and that's definitely what I'd go with in that situation. It would be easy enough to upsize your Jet back end to SQL Server on your local PC, and then do a backup that you could import to your website.

You can use LINQ to DataSets to use Linq against an Access .mdb or .accdb database.
You can read more at http://msdn.microsoft.com/en-us/library/bb386977.aspx and http://blogs.msdn.com/adonet/archive/2007/01/26/querying-datasets-introduction-to-linq-to-dataset.aspx

Related

SQL Server Express Database hosted on Network Share - Is it Possible?

I've started work on a project that requires an SQL Server Database. I will be building a front end application in c# .Net 3.5, that will use LINQ to SQL.
I need to host the database on a network share so that a group of users can all gain access to the database, mainly for read only.
I know that SQL Server Compact is designed to run on the local machine and my company is not willing to front the costs of a full blooded SQL Server.
Is there a way of achieving what I need to do via SQL Server Express?
If so, which are the best guides on how to set this up?
Thanks
If you go with the (free) SQL Server express, it will do what you need - but you don't access it thru a network shared drive - the server would be located by an ip address (or equivalent DNS).
You c# application would be talking to a service - SQL Server - not reading to/from a database file. The service will handle the interaction with the database. Only the SQL Server service will need to know where the file actually is - your client machines won't know and shouldn't care.
If your background is only with file-based databases - i.e. MS Access, you need to change your mindset a bit about how SQL server works.
You can install a SQL Server Express instance and install the SQL Management Studio Express for all users who need access to the database. The Express Edition is a standard SQL server with limitations regarding the number of processors used, the maximum amount of memory used and the maximum database size. If these limitations don't bother you, it should work fine for you.
Using a network share as a database storage to access db files from several clients is a bad idea, as the sql server instance should always be the only one directly accessing the database, both for read and write access. Configuring several instances of SQL Server to access the same database will probably not work - and if it works, it will probably create havoc in your database files.

Best choice of database for my C# application

I'm writing an application which will involve interaction with the database. The application will be used by users from the scale of 100 to 1000 and the database should be able to store up to 100,000 rows of data.
Previously I have used Microsoft Access but my users were required to install microsoft access database engine for my application to function as intended. I want my application to as light weight/portable as possible, so is there any better alternatives where users will not be required to install any third party components to run my application?
Look at mongoDB, it is an open source non relational database that has picked up popularity. Its is very fast too.
Depends on whether the DB will be server side or client side.
If it's server side it's up to you really, I would personally go SQL Server as I know that best, or even a mySql/phpMyAdmin combo. But if it's to reside on the client machine try SQLite (just a warning though it is exactly as the name suggests, LITE, so a lot of the more complex SQL might not be supported). SQLite may be exactly what you're looking for depending on the complexity involved in your project.
ALSO: SQLite is supported on iPhone, Blackberry and Android as well. So if you wanna go mobile, no problem.
Your application could connect to a cloud database (like SQL Azure). That will not require any third party components and it will be accessible from anywhere/any device.
Do you need a only one database for all the users or every user has it's own database? If it will be on the server side, i would prefer SQL Servers (ex. MSSQL, MySQL). But for clients side, SQLLite would do the work.
You should consider if a SaaS model is relevant, in other words if you could benefit from hosting all your users' databases on the cloud and let clients access it by remote. In your scenario I would consider a SaaS model if: (1) your users need to scale up their individual database beyond the capacity of their local machine, (2) there is a need to share data between the databases of different users - or maybe this could enable good features you don't have in your system today, or (3) users find it a drag to have to run the database on their local machine, because of the resources it uses up, uptime needed, backups, etc. If any of these are sometimes true, hosting all the databases on the cloud with some sort of multi-tenancy arrangement might be a good solution and will make your application as lightweight as possible because you don't need to include a database at all.

Deploy database along with project

I need to create an application that does the following:
The application is going to be installed on multiple computers on the same network
There is going to be a computer that contains the database other computers will connect to that database. (So there is a server version of the software and a client version)
All the computers that have the application installed should be able to do CRUD (create, read,...) operations in the database.
Database will be small, that is it should be less than 1GB in size.
Problems that I have:
I don't know which database to use:
SQLite - From researching on the internet this seems like a great database. It is fast, very easy to deploy . The problem is that from researching I think it is not that good handling multiple connections. When I say multiple I mean 5 computers using the database simultaneously.
MySQL - I work with this database and I know it is great handling multiple connections. The problem with that database is that I don't know how I will be able to deploy that database. I am required to deploy a database when installing the software. I know that if I require the users to instal MySQL doing a separate installation that will work. Maybe there is a way of deploying MySQL when doploying a project in visual studio.
SQL Server Express - I believe this will be my best option. I have researched on the internet and I found out that it is possible to deploy a SQL Server Express database with a application. I believe it will be easy to figure out how to deploy such database with a project but it will be nice if someone can point me on the right direction on how to connect to that database remotely from a computer on the same network. The database will obviously be shared in the network in order to achieve this.
Microsoft Access Database - I never use this database. I know it can handle multiple connections. Maybe it is a good choice.
It will be nice if someone can point me on the right direction of how to be able to deploy a database when installing my application. Moreover how will I be able to connect to that database from a computer remotely on the same network. Since the database is small and it will just contain text I think that the best idea will be to keep the database on the internet but I cannot do that. The software is required to work without an internet connection.
EDIT
From looking at your answers it looks like I have to install SQL Server express or MySql on the server computer. The problem is that I am required to do one installation. Is there a way of deploying MySql or SQL Server Express when deploying my application. Perhaps I have to embed mysql in the application and make my application install it somehow. My boss want to be able to install the software without having a internet connection.
EDIT 2
I been thinking and this part will be very hard to implement. Do you guys have any ideas how QuickBooks implement their database? I guess I need something similar. When you install Quickbooks you perform just one installation. Quick-books handles pretty well simultaneous connections. Do they use their own database? Oracle? MySQL? I agree with all of you. It will be so easy to perform two installations. Also it will be cleaner. The software that I am creating is supposed to run on windows xp, and latter versions of windows.
If you want a dbms as your backend you are installing two things, It could look to the user like one thing, but I can tell you from bitter experience, that can be a lot of fun.
For instance to install 2005/ 2008 express, there are various prerequisites. Like a .net framework. Then there's patches and updates, then opening up the firewall(s), depends on set up. Different topology / os choices. Peer to peer, domain based, Active directory, Terminal Services, citrix.
So automagically installing without an internet connection, and using the installer for the db, is nigh on impossible, unless you have rigid control over the user environments.
Welcome to a world of hurt.
Oh did I mention permissions, shares, UAC, 32/64 bit (for sql server dmo and smo, maybe)
Do you want to block installs on "incompatible" environments.
Oh and what about upgrades. To the db, to your apps.
What if your client already has a server install and doesn't want to clutter up their kit with another...
and many many more.
And I bet you just can't wait to test all the potential combinations.
You haven't said what your target environments are going to be, so I can't say how many worms are in the tin, but its's very big time with plenty of room for lots of worms.
Ours is a long running legacy app, so we are pretty much snookered, I'd never willingly start with this design again though. Locally deployed web app would take a lot of the pain out of it.
Go back and scare the crap out of your boss.
I would recommend Sql Server Express installed on a server on your network.
Microsoft Access doesn't handle multiple simultaneous connections very well and is not very efficient when accessed from a remote machine.
You don't need to worry about deploying the database with your client application, you can install Sql Server Express directly on the server. (This only needs to be done once). You will need to configure Sql Server Express to accept remote connections after it is installed on the server.
SQLexpress supports multiple connections. So if you attach database on "server" computer you can than connect from clients same way as you would to local database.(provided those computers are in LAN or VPN).
Several articles on the Internet mention that SQLite is not that good handling multiple connections if all the connections are writing to the same database. I finally managed to deploy my application with SQL Server 2008 express. I also deployed my application with SQLite (downloaded the latest version for .NET framework 4). Since I plan to use this database just on a local network (LAN) I gave SQLite a try. I was impressed on how efficient SQLite was. I tested the Database by connecting with 4 computers symoltaniously and constantly writing data (inserts) to the database. No data was lost. When I did this with SQL express it was also very efficient and I could not tell a obvious difference. Maybe you get to see a real difference once there are 50 computers connected like on a web server for example.
Other nice things about SQLite are that it does not take time to deploy. Also there are no heavy services constantly running. I guess that SQLite is a better choice than SQL express. Moreover SQLexpress will only use 1 CPU and the database is limited to 2GB.
I am going to mist the Linq to SQL classes thought. They where very easy to implement with SQL Server Express. So in short I think that every database is good at something. And in this scenario I guess SQLite was a better option for me and for the users.
P.S.
I am interested in seeing how SQLite lattest version will hanle multiple connections compared to SQLexpress. I will try to test soon with more computers and each computer running multiple threads, each thread performing an insert in the database. maybe I,ll see a big difference with that scenario.

developing sql application using local database

I am starting an application (c#, .net) that will interact with a Microsoft SQL database. I need the ability for multiple clients to access the data concurrently so I an going to use a service based database (.mdf). Is it possible to develop the application using a local database (.sdf) and then easily switch it over to a service based database when it comes time for deployment? Is that how this type of development it typically done?
You can control the data source by providing connection string to your database in .config file.
You can even create Debug and Release versions of your .config file with different connection strings. Debug can point to your local machine and Release to production.
Development shops vary, but it is pretty common to develop apps using SQL Express locally and then use a full installation of SQL Server for the production environment.
The only thing I would advise is make sure that the DB you chose for your dev environment supports the same features as what you expect in production. For example don't use SQL Express on your dev box when you expect to use Oracle in production.
If the database schema in both backends is exactly the same than the only thing you will need to do is change the connection string when you are ready to move to the service based database.
Be aware that the slightest change in the schema can (and probably will) cause problems.
You want to use SQL Compact Edition (as you said database file extension is .sdf), right? You can use MSSQL Express Edition instead, as it acts more like full MSSQL Server, and is still free and not so hard to install on developer's machine (I personally prefer this option). There are differences between the two (as explained here: http://blog.sqlauthority.com/2009/04/22/sql-server-difference-between-sql-server-compact-edition-ce-and-sql-server-express-edition/). If you don't want features like triggers/procedures/views in your database, you can still use CE, though.
If you have multiple clients then you should use SQL Server Express (.mdf file) - SQL Server Compact (.sdf file) is useful when you are building an application that is going to be deployed on client machines and will run standalone, e.g. windows forms application with a local database. SQL Server Compact is just an alternative for MS Access .mdb files or SQLite, the so called "embedded databases", while SQL Server Express is a real database server (albeit with some limitations to render it unsuitable for large commercial applications) and should be used in the cases where multiple clients use central database, e.g. web applications and smart client apps (the latter could also make use of a local embedded database though).

fast local database

i have a desktop application that talks soap to a server. the communication is very slow so i want to download a lot of the data up front and query from my local database. i wan this local data to persist after the application shuts down so what is the best way for doing this . . . are there any good products / examples to do this . . there are about 25 tables that i am caching.
SQLite is perfect for this. A couple years ago I wrote a "smart client" application where I maintained a local cache so that users could still use the application offline. I used SQLite and had no problems, it is very small, persists quickly, and most modern ORMs support it. (I was using NHibernate)
http://www.sqlite.org/
Berkeley DB is a good, standalone DB. You should also consider ESENT, which is built into windows. Here's a write-up by Ayende.
The H2 database might also meet your needs. Microsoft offers a compact edition of SQL Server: SQL Server Mobile Edition. If SQL Server and TSQL is your thing, this might be a good choice.
You could always use an Access DB, usually pretty simple to ingereate with in .NET app and doesn't require any server to be installed or configured on the client.
Consider using Firebird, I believe they have a ADO.NET extension too.
I would consider SQL Server Express or even SQL Server Compact Edition, which operates on individual database files, like Access does. Despite this, it's still SQL Server.
You could also consider Apache Derby, which is used in Sun's Glassfish Java EE server.

Categories