473,587 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data abstraction layer, is there something around?

Hi guys,

I'm coding an application connected to a database. I have some clients that
use this program with 2 or 3 computers, and I use MsSQL Express for them.
But if the client needs more computers to be connected to the database, I
have to use a standard MsSQL. No problem with that, but I want to be able to
switch from a database provider to another in an easy way.

I know that this way to do is called "Data(base) abstraction layer", but I
don't know how to use it. I've read some articles around the Internet, like
this one http://www.codeproject.com/cs/database/dalgen.asp, but I don't want
to have to regenerate source code each time I change the database. If it is
possible, I would like to use SQL to do my queries, and I have to be able to
do "complex" queries (joining, subselecting, ...).

The databases I would like to be able to use are MsSQL (Express or not),
MySQL, and if possible Oracle.

Is there something to do this in the Framework? Or maybe some open source
library?

Thank you for your help.
Oct 13 '06 #1
3 5083
Check out the Data Access Application Block from the Microsoft
Enterprise Library:
http://msdn.microsoft.com/library/en...ssappblock.asp

S. Lorétan wrote:
Hi guys,

I'm coding an application connected to a database. I have some clients that
use this program with 2 or 3 computers, and I use MsSQL Express for them.
But if the client needs more computers to be connected to the database, I
have to use a standard MsSQL. No problem with that, but I want to be ableto
switch from a database provider to another in an easy way.

I know that this way to do is called "Data(base) abstraction layer", but I
don't know how to use it. I've read some articles around the Internet, like
this one http://www.codeproject.com/cs/database/dalgen.asp, but I don't want
to have to regenerate source code each time I change the database. If it is
possible, I would like to use SQL to do my queries, and I have to be ableto
do "complex" queries (joining, subselecting, ...).

The databases I would like to be able to use are MsSQL (Express or not),
MySQL, and if possible Oracle.

Is there something to do this in the Framework? Or maybe some open source
library?

Thank you for your help.
Oct 13 '06 #2

First, its important to understand tiered development.
This will make more simple for you.

Check this:
http://sholliday.spaces.live.com/?_c...26ayear%3d2006

As the previous poster pointed out............ ...Check into the Enterprise
Library data access application block. (I'll abbreviate this as ELDAB for
this post)

One aspect of the ELDAB is that it allows a "common syntax" to whichever
database you're talking.
Access
Excel
Sql Server
Oracle

And you're able to switch the database....... ..in a dataConfigurati on.config
file (1.1, 2.0 is the same concept but a little different)

............
Back to the tiers:
If you're datalayer object only returns
DataSet's
IDataReader's
Scalars
Void's/Nothing's

The the backend db doesn't become as big an issue.
.........

Now , sometimes the ELDAB is not sufficient.

The next thing you could do is create Interface(s) for the DataAccess Layer.

Lets call one
IEmployeeDataLa yerObject
pubic DataSet GetInfo(int empid)
public void UpdateInfo(int empid, string fname, string lname)
You create 2 concrete versions of IEmployeeData
EmployeeDataFor Access : IEmployeeDataLa yerObject
and
EmployeeDataFor Oracle : IEmployeeDataLa yerObject

You create a simple Factory class, which returns 1 of the 2 concrete
objects.
See
12/1/2005
Understanding the Simple Factory Pattern
http://sholliday.spaces.live.com/?_c...26ayear%3d2005

and look at the "reflection " example.
Normally, you don't have to go to the extreme of doing this last step.
However, I send alot of xml into my datalayers.

IEmployeeDataLa yerObject
public void UpdateInfo(XmlD ocument xmlDoc)

In this case, ........... I can actually send the raw xml into Sql
Server.....beca use it has an OPENXML command.
For Access, there is no internal Xml functionality, so I have .. create a
transaction in code, loop over the xml, and run several statements against
the Access database.
For Oracle, I've played with their xml functionality, and as far as 9.xxxx,
I was disappointed in it.

In this case, the ELDAB is deficient. But I can get around it with the
interfaces for the IEmployeeDataLa yerObject, several concrete classes, and
using the "Simple Factory" design pattern with reflection (or "key" method)

This should help.

But first off, you need to get the Tiers correct, or you're just
complicating your life too much.

"S. Lorétan" <tynril@[nospam]gmail.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Hi guys,

I'm coding an application connected to a database. I have some clients
that
use this program with 2 or 3 computers, and I use MsSQL Express for them.
But if the client needs more computers to be connected to the database, I
have to use a standard MsSQL. No problem with that, but I want to be able
to
switch from a database provider to another in an easy way.

I know that this way to do is called "Data(base) abstraction layer", but I
don't know how to use it. I've read some articles around the Internet,
like
this one http://www.codeproject.com/cs/database/dalgen.asp, but I don't
want
to have to regenerate source code each time I change the database. If it
is
possible, I would like to use SQL to do my queries, and I have to be able
to
do "complex" queries (joining, subselecting, ...).

The databases I would like to be able to use are MsSQL (Express or not),
MySQL, and if possible Oracle.

Is there something to do this in the Framework? Or maybe some open source
library?

Thank you for your help.


Oct 13 '06 #3
S. Lorétan wrote:
Hi guys,

I'm coding an application connected to a database. I have some
clients that use this program with 2 or 3 computers, and I use MsSQL
Express for them. But if the client needs more computers to be
connected to the database, I have to use a standard MsSQL. No problem
with that, but I want to be able to switch from a database provider
to another in an easy way.

I know that this way to do is called "Data(base) abstraction layer",
but I don't know how to use it. I've read some articles around the
Internet, like this one
http://www.codeproject.com/cs/database/dalgen.asp, but I don't want
to have to regenerate source code each time I change the database. If
it is possible, I would like to use SQL to do my queries, and I have
to be able to do "complex" queries (joining, subselecting, ...).

The databases I would like to be able to use are MsSQL (Express or
not), MySQL, and if possible Oracle.

Is there something to do this in the Framework? Or maybe some open
source library?
If you're looking for a library which allows you to write SQL AND use
all kinds of different databases, you're out of luck: there's no SQL
standard which is implemented by all databases, or you've to fall back
on SQL-92, and even then it's not always implemented in all details in
all db's.

So, you have to make a choice:
- use stored procedures in all the databases you're accessing and call
them using a somewhat unified api. This is maintenance intensive but
could work
- use an O/R mapper. An O/R mapper offers you the ability to work with
multiple databases and not to worry about the different SQL dialects
and db specifics, you just write code against the o/r mapper api and
leave the sql generation over to the o/r mapper.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Oct 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3127
by: 11abacus | last post by:
Hi, Just wondering if any of you has thought about or is working on a payment gateway abstraction layer (PEAR-style)? I'm interested on developing that or at least start a discussion about it. The package would provide a framework for all types of online (and offline?) payment transactions.
16
3006
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For example dsParts.xsd and including that in the data tier. I then will create a class that looks like this Public Class CPart Inherits dsParts
10
5772
by: Zap | last post by:
Widespread opinion is that public data members are evil, because if you have to change the way the data is stored in your class you have to break the code accessing it, etc. After reading this (also copied below for easier reference): http://groups.google.it/groups?hl=en&lr=&safe=off&selm=6beiuk%24cje%40netlab.cs.rpi.edu&rnum=95 I don't agree anymore.
4
2112
by: Luiz Geron | last post by:
Hi all, I'm testing the PDO wrapper to database modules and I'm wondering how few things like this there are around. My problem, actually, is the paramstyle of modules. I want to use kinterbasdb in the same code I use cx_oracle, for example, but paramstyle changes from one to other, than I searched for things like this and found nothing really usefull. The problem with PDO is that it was so dificult to find, since a few people seems to...
30
2211
by: Luke Wu | last post by:
Hello, >From spending some time in clc, I've come to realize that C's model of the CPU can be totally different from the atual CPU. Is it safe to say that almost nothing can be gleaned about physical CPU behaviour from C level behaviour. For example:
5
2123
by: Kevin C | last post by:
I was curious to know what some developers out in the industry are doing when it comes to exposing Data access logic, specifically persistence. This is assuming that your not using an O/R framework or something that completely abstracts you from the persistence details. Are you: 1. Having simple data type interfaces and the data layer know nothing about the domain models. For example: public int SaveCustomer( string fname, string...
2
1817
by: Eric Cathell | last post by:
I am using dOOdads as my persistence layer. I have a business object Person that sits in a Project called DOMAIN I have 2 dOOdads in a project called BLL. one is _Person and is declared MustInherit the other is Person and is my concrete class. My main goal of BLL.Person is to protect custom methods and properties against regeneration.
17
46498
Motoma
by: Motoma | last post by:
This article is cross posted from my personal blog. You can find the original article, in all its splendor, at http://motomastyle.com/creating-a-mysql-data-abstraction-layer-in-php/. Introduction: The goal of this tutorial is to design a Data Abstraction Layer (DAL) in PHP, that will allow us to ignore the intricacies of MySQL and focus our attention on our Application Layer and Business Logic. Hopefully, by the end of this guide, you will...
1
1881
by: BJ Dierkes | last post by:
Hello all, I am looking for opinions on preferred methods of Database Abstraction Layer or Object Relation Mapper (I'm using Python 2.5). I have found a number of options such as those listed here: http://wiki.python.org/moin/HigherLevelDatabaseProgramming I'm not looking for a holy war based on whether a DAL/ORM *should* be
0
7854
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8219
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7978
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3845
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.