?
Solved

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

Posted on 2010-08-15
5
Medium Priority
?
395 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 2000 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

649 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