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

  • Home
  • SEARCH
  • 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 8543291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:16:02+00:00 2026-06-11T12:16:02+00:00

I am doing some work updating a data access library that our company uses

  • 0

I am doing some work updating a data access library that our company uses to call stored procedures on an Oracle database. The library currently allows the calling application to use a single OracleCommand (IDbCommand) object and a single OracleConnection (IDBConnection) to make several calls. This means the caller would add parameters for a call, make the call, clear the parameters and repeat. When finished, the consumer application calls dispose to clean everything up.

I can make things much cleaner by using “using” statements within the library to make sure the command and connection objects are cleaned up after each call but this would mean the above functionality would be lost and a new command/connection would be created per call. I see this being done in most examples I find, but then they are usually only simple examples.

My question: Is it worthwhile to allow the command and/or the connection to persist between calls? Is it overly expensive to recreate them each time?

  • 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-06-11T12:16:03+00:00Added an answer on June 11, 2026 at 12:16 pm

    It is about scalability. The cost to create and dispose a command is cheap. Holding the connection open is the costly part. If you have 1000 active clients holding 1000 open connections then that is a load on the database. I often hold the connection object but just close the connection. That takes the load off the database and there is very little overhead to holding a connection object in .NET. In a typical end user program a connection is only used a small fraction of the time so closing the connections when not in use those 1000 users may only have 10 active connections. Now a programs like a data loader using a connection 1/2 the time then leave the connection open.

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

Sidebar

Related Questions

I am doing some work on an inbound call demand capture system where each
I have some old code that I'm updating to work in firefox, and I've
I'm doing some work with grades and the desire2learn Valence API. In the context
I am doing some work to track down a perceived bug in a git
I'm doing some work with Ukkonen's algorithm for building suffix trees, but I'm not
I'm doing some work with registry hives, and I need to know if the
I'm doing some work with the JavaSound API to send a MIDI System Exclusive
I am doing some work with Web.Routing, using it to have friendly urls and
I'm doing some work with stats, and want to refactor the following method :
Recently I'm doing some work with two Series in pandas: The first Series contains

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.