dbTalk Databases Forums  

Stored Procedures for encapsulated data access

comp.databases comp.databases


Discuss Stored Procedures for encapsulated data access in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jo Siffert
 
Posts: n/a

Default Stored Procedures for encapsulated data access - 02-26-2004 , 05:16 AM






Hi all,

are there any drawbacks or is it bad design to create stored procedures
for all required data access-scenarios to hide the table structure,
queries etc. (and changes that may be made to them) from the application?

Thanks,
js

Reply With Quote
  #2  
Old   
Robert Klemme
 
Posts: n/a

Default Re: Stored Procedures for encapsulated data access - 02-26-2004 , 05:59 AM







"Jo Siffert" <jo.siffert (AT) gmx (DOT) net> schrieb im Newsbeitrag
news:c1kkh2$43i$1 (AT) zeppelin (DOT) rz.uni-potsdam.de...
Quote:
Hi all,

are there any drawbacks or is it bad design to create stored procedures
for all required data access-scenarios to hide the table structure,
queries etc. (and changes that may be made to them) from the
application?

These are the drawbacks I can think of:

- With MS SQL Server you can't commit transactions inside the SP - at
least not when working via JDBC. MS SQL Server mimics nested transactions
by counting the begin-commit pairs and really committing only on the top
level.

- Some databases don't support stored procedures or the support is not
complete.

You can use views for most queries and on some databases also for
insertions.

robert



Reply With Quote
  #3  
Old   
Alfredo Novoa
 
Posts: n/a

Default Re: Stored Procedures for encapsulated data access - 02-26-2004 , 08:46 AM



On Thu, 26 Feb 2004 12:16:02 +0100, Jo Siffert <jo.siffert (AT) gmx (DOT) net>
wrote:

Quote:
are there any drawbacks
Many.

Quote:
or is it bad design to create stored procedures
for all required data access-scenarios to hide the table structure,
queries etc. (and changes that may be made to them) from the application?
Very very bad design.

Tables are the only thing applications should see.


Regards
Alfredo


Reply With Quote
  #4  
Old   
Jim Kennedy
 
Posts: n/a

Default Re: Stored Procedures for encapsulated data access - 02-26-2004 , 09:15 AM




"Jo Siffert" <jo.siffert (AT) gmx (DOT) net> wrote

Quote:
Hi all,

are there any drawbacks or is it bad design to create stored procedures
for all required data access-scenarios to hide the table structure,
queries etc. (and changes that may be made to them) from the application?

Thanks,
js
Assuming your database has stored procedures this works very well. For
example, if you need to tweak the syntax etc. you don't have to redeploy the
application. Just change the stored procedure.
Jim




Reply With Quote
  #5  
Old   
Bob Badour
 
Posts: n/a

Default Re: Stored Procedures for encapsulated data access - 02-26-2004 , 09:42 AM



"Jo Siffert" <jo.siffert (AT) gmx (DOT) net> wrote

Quote:
Hi all,

are there any drawbacks or is it bad design to create stored procedures
for all required data access-scenarios to hide the table structure,
queries etc. (and changes that may be made to them) from the application?
Jo,

Data is much more portable as tables (ie. relations). Constraints are much
more portable as well formed formulae (ie. relational expressions) and
foreign key references etc.

No two vendors use the same stored procedure language. In some cases where a
vendor sells multiple dbmses, the vendor's dbmses use different stored
procedure languages.

However, if you want to centralize part of your application for physical
performance reasons, stored procedures are a handy facility for doing that.
Just keep clear in your mind that the stored procedures are actually part of
the application.

Ideally, we would prefer to use a higher level application programming
language that deals directly with relations and a distributed dbms where the
optimizer could assist in the decision of where to execute what.




Reply With Quote
  #6  
Old   
Christopher Browne
 
Posts: n/a

Default Re: Stored Procedures for encapsulated data access - 02-26-2004 , 10:01 PM



Jo Siffert <jo.siffert (AT) gmx (DOT) net> wrote:
Quote:
are there any drawbacks or is it bad design to create stored
procedures for all required data access-scenarios to hide the table
structure, queries etc. (and changes that may be made to them) from
the application?
It can arguably be anti-relational, depending on how the stored
procedures are designed.

To be sure, it diminishes the flexibility of "use cases" for the
system in that (assuming system users are required to use the
procedures) it forces certain access paths.

The flip side is that this allows there to be two sets of developers:

1. Database developers, who are responsible for providing useful
sets of stored procedures, and

2. Application developers, who use what the DB guys provide.

And the separation can allow the DB guys to change the structure of
handling of things in the DBMS without the applications guys having to
worry about it.

Furthermore, it is common for "application developers" to not really
understand relational databases very well. They are likely happier
with a decent API; that means that it is the "DB guys," who are deeply
engaged in DB work, who have to understand the "relationalness" of the
system. That may well be a good way to separate that out...
--
output = ("cbbrowne" "@" "cbbrowne.com")
http://www.ntlug.org/~cbbrowne/rdbms.html
Developmental Psychology
"Schoolyard behavior resembles adult primate behavior because "Ontogeny
Recapitulates Phylogeny" doesn't stop at birth."
-- Mark Miller


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.