Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3622790
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:18:12+00:00 2026-05-18T23:18:12+00:00

If I am correct then the idea behind having an interface for data access

  • 0

If I am correct then the idea behind having an interface for data access objects is that the actual store, whether it is database, file, or XML is hidden from the client code. But if you are using SqlCommand and SqlConnections and something goes wrong and it throws a SqlException, then the client code becomes aware of the implementation and the fact that we are using a MS Sql server as the database. So we can change the client code to catch DbException. But then we are making the client aware of the implementation. So this seems like a leaky implementation to me.

I think the correct approach would be to wrap into custom DAL exceptions which the client code could respond to. It just seems like a lot of work to do when

  1. The database is unlikely to change.
  2. The store type (database, file, xml) is even more unlikely to change.

In this scenario should the client code just handle the SqlException itself. The client code is more closely coupled but I honestly don’t see it changing. Or is it still worth wrapping the exceptions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T23:18:12+00:00Added an answer on May 18, 2026 at 11:18 pm

    If you are talking about persistence ignorance (and wish to retain it), then correct, you shouldn’t let SQL Exceptions bubble up as they are.

    You should create your own specific exception types and in your implementation wrap any exception with your custom exception (PeristenceExcpetion?) as an InnerException.

    Having said that, if you know that you are not changing your store type and database, then there is little reason to decouple the exceptions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is my idea correct? How are Java Database Access Layer usually implemented? I am
If I'm correct then the releasing of the pool of autoreleased objects has something
whats the correct way to cache a object(DataSet) and then get it and when
My Dispatcher is choosing correct Controller; then creating Controller's instance (DependencyInjectionContainer is passed to
If the statement above is correct, then why when I use reflector on .Net
Am I correct in saying it is TSQL? I am a novice at database
I know that the title is very subtle but I have absolutely no idea
I'm trying to build and app that shows organized data so I'm thinking that
If sbt-idea is used to create a sbt based intelliJ project, then what is
I am about to write a function that finds a correct handler for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.