Using any Data Provider

  • Thread starter Thread starter Dino Buljubasic
  • Start date Start date
D

Dino Buljubasic

Hi,

How do I write a db driven app that will work independently of data
provider. No matter whether backend is Oracle, SQL Server, mySQL or
Access, it should work smoothlesly

tx
 
You can use something similar to the DBProviderFactory model in .NET 2.0.

Do realize however that when writing code for specific data sources, there
will be lot of code that you will have to write for each database
seperately. In other words, a TSQL stored proc, will never be the same as a
PLSQL stored proc etc.

In short the epitome of the database independent data layer - is impossible.
But you should seperate that junk out in a layer as thin as possible.

- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
 
u are wrong. if you design your data access layer clever enough, its
possible..

its nearly possible to implement all T-Sql stored procedures in pl-sql just
with a few tricks and/or syntax. but oracle has ref cursor output parameter
you have to use when you use datareader. if your ExecuteReader methods in
your dataacess layer cleverly adds that parameter to executing commands
parameter collection, it should run in the same manner. all you have to do
rest is rewriting stored procedures in pl-sql. (if you use any)
 
Dino,

I added an answer in the ADONET newsgroup on your same message about this.
(As more did that today)

Cor
 
The Crow,

All TSQL procedures can be implemented in PLSQL - afterall equivalent logic
concepts do exist on either side.

However, since the two databases are inherently different, the function
names are different, concurrency mechanisms are different, and a number of
other differences, it will rarely be as simple as the example you pick.
Trust me, it is not as simple as "cleverly adding a parameter".

For selects it may even work, the real problem occurs when you try saving
data back into the database.
 

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

Back
Top