Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Open two SQLConnections to same server from one application

Posted on 2012-08-27
2
Medium Priority
?
441 Views
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; ...."

DbCon1.Open
DbCon2.Open <<---- hangs
0
Comment
Question by:CumulusGranitus
2 Comments
 
LVL 2

Accepted Solution

by:
itmarsolutions earned 1000 total points
ID: 38336304
i tested it. couldnt found any errors.

just try this one.

DbCon2.Open
DbCon1.Open

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

Author Comment

by:CumulusGranitus
ID: 38336617
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.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

810 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