Solved

How do I get the name of the server that the DSN connected to?

Posted on 2010-08-15
5
390 Views
Last Modified: 2012-05-10
Hi,

Say, I have two DB Servers(server1 and server2). I have a DSN (Data Source Name) named mydsn. It should be connected to server1. My program should ensure that mydsn is mapped to server1.

How do I get the name of the server that the DSN connected to?

Thank you.
Regin
0
Comment
Question by:Fi-es
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 7

Expert Comment

by:bclongacre
ID: 33443436
If you are looking specifically to see what server you are getting a response from.

Click Start
Click Run
Type CMD
Press Enter

Type "nslookup", not including quotes, a space then any computer name, IP Address, or web site, and first entry will list the Server queried.

If you want to see what your DNS server settings are you can do the following:

Click Start
Click Run
Type CMD
Press Enter

Type "ipconfig /all" not including quotes then press Enter
0
 
LVL 7

Expert Comment

by:bclongacre
ID: 33443444
My apologies, I had a dyslexic moment, and read DNS as opposed to DSN, and I did not realize it until after I hit the Submit button.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 33443469
you have to connect using the DSN, and then query for the server name:

select @@server

the issue is that even if a "server name" is written in the connection information of the DSN, it could still be an alias.
only connecting and running the above query will give the full instance name actually...
0
 
LVL 4

Expert Comment

by:Audhi203
ID: 33443616
Start -> Control Panel -> Admin Tools -> Data Sources -> Check with the DSN you created if Server name is correct. Also http://support.microsoft.com/kb/138541
0
 

Author Comment

by:Fi-es
ID: 33443748
Thank you all for your help.

Audhi203,
I donot want to manually verify the server. But my program has to ensure if the client machine is connected to the right server.

angelIII,
your solution solves my problem. Your query has a careless mistake.
Right query is
select @@SERVERNAME
I am going to accept your reply as the solution.
0

Featured Post

Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

Question has a verified solution.

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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

737 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