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 8914849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:49:51+00:00 2026-06-15T04:49:51+00:00

My hosting company blocked my website for using more than 15 concurrent database connections.

  • 0

My hosting company blocked my website for using more than 15 concurrent database connections. But in my code I closed each and every connection that I opened. But still they are saying that there are too many concurrent connections. And suggested me the solution that I should change the source code of my website. So please tell me the solution about this? And my website is dynamic, so would making it static simple HTML old days type will make a difference or not?

Also note that I tried this when no solution I can think of, before every con.open(), I added con.Close(), So that any other connection opened will be closed.

  • 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-15T04:49:52+00:00Added an answer on June 15, 2026 at 4:49 am

    The first thing to do is to check when you open connections – see if you can minimise that. For example, and you doing “n+1” on different connections?

    If you have a single server, the technical solution here is a semaphore – for example, something like:

    someSemaphore.TakeOne();
    try {
        using(var conn = GetConnection()) {
            ...
        }
    } finally {
        someSemaphore.Release();
    }
    

    which will (assuming someSemaphore is shared, for example static) ensure that you can only get into that block “n” times at once. In your case, you would create the semaphore with 15 spaces:

    static readonly Semaphore someSemaphore = new Semaphore(15,15);
    

    However! Caution is recommended: in some cases you could get a deadlock: imagine 2 threads poorly written each need 9 connections – thread A takes 7 and thread B takes 8. They both need more – and neither will ever get them. Thus, using WaitOne with a timeout is important:

    static void TakeConnection() {
         if(!someSemaphore.TakeOne(3000)) {
             throw new TimeoutException("Unable to reserve connection");
         }
    }
    static void ReleaseConnection() {
         someSemaphore.Release();
    }
    ...
    TakeConnection();
    try {
        using(var conn = GetConnection()) {
            ...
        }
    } finally {
        ReleaseConnection();
    }
    

    It would also be possible to wrap that up in IDisposable to make usage more convenient.

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

Sidebar

Related Questions

I have a web site which uses one SQL database but the hosting company
I'm considering using a third party hosting company to house an SVN repository. (I'm
I tried searching for a hosting company that would support MVC4 but I couldn't
i using sql2005, my hosting company allow me to use 300mb for my sql
I am trying to connect to make SSH connections with PHP my hosting company
I have some PHP source code that I'm hosting with hosting company XYZ. I'm
Seriously. My hosting company says that there's something wrong with my Php code. I'm
If I am storing my source code in SVN on a shared hosting company,
I've just cleaned up a friend's e-commerce website. The hosting company had detected and
I'm trying to run a python script using python 2.6.4. The hosting company has

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.