Open two SQLConnections to same server from one application

Posted on 2012-08-27
Last Modified: 2012-08-27
I want to open two connections to different databases in the same server. Opening the first connection works, the second open always hangs and runs to connection timeout.

Form (VB.NET):

dim DbCon1 as new SQLConnection
dim DBCon2 as new SQLConnection

DBCon1.ConnectionString=" ...; Initial Catalog=Db1; ...."
DBCon2.ConnectionString=" ...; Initial Catalog=Db2; ...."

DbCon2.Open <<---- hangs
Question by:CumulusGranitus
    LVL 2

    Accepted Solution

    i tested it. couldnt found any errors.

    just try this one.


    if still u got the same error then you have some thing wrong in your 2nd connection string

    Author Comment

    It was my mistake. The first connection i opened with "Data Source=LOCALHOST", the second with "Data Source=PCx\SQLEXPRESS" ...
    If i open the second one with LOCALHOST too it works. Thanks for your hint.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
    Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
    Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
    Viewers will learn how the fundamental information of how to create a table.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now