简体   繁体   English

Windows 7上的DSN如何解析主机名?

[英]How does DSN on Windows 7 resolve the host name?

This is just an informational question, but I was hoping someone out there might have a link to some documentation that shows how this works. 这只是一个参考性问题,但是我希望那里的某个人可以链接到一些说明该工作原理的文档。

Issue: 问题:

Creating a DSN on a Windows 7 (x64) system to a locally installed database server, it will not resolve if using the machine name such as "MyComputer". 在Windows 7(x64)系统上为本地安装的数据库服务器创建DSN,如果使用计算机名称(例如“ MyComputer”),则无法解析。 A timeout error occurs. 发生超时错误。

If you ping "MyComputer" from the command prompt then you get the correct IP address (::1 / 127.0.0.1). 如果在命令提示符下ping“ MyComputer”,则将获得正确的IP地址(:: 1 / 127.0.0.1)。

Solution: 解:

If you add a DNS entry in the hosts file for "MyComputer" (127.0.0.1 MyComputer) then test the DSN it works. 如果在主机文件中为“ MyComputer”(127.0.0.1 MyComputer)添加DNS条目,则测试DSN可以正常工作。

if you use the IP address in the DSN (127.0.0.1) it works. 如果您在DSN(127.0.0.1)中使用IP地址,则可以使用。

Question: 题:

Exactly how does Windows 7 resolve the name of the server entered for a DSN? Windows 7究竟如何解析为DSN输入的服务器的名称? It looks like it only uses TCP/IP and DNS to resolve it, hence why adding the DNS entry in the hosts file resolves the timeout. 看起来它仅使用TCP / IP和DNS来解决它,因此为什么在主机文件中添加DNS条目可以解决超时问题。

Does anyone have any information to back up this assumption? 是否有人有任何信息来支持这一假设?

Your computer is not called 'mycomputer' If you right click on the 'my computer' icon and choose properties it will display the Computer Name about a third of the way down the page. 您的计算机不称为“我的计算机”。如果右键单击“我的计算机”图标并选择属性,它将在页面的大约三分之一处显示“计算机名称”。

By adding the entry in the host file, 127.0.0.1 MyComputer, you are instructing your pc that if someone pings or explores to mycomputer resolve that name to the address of 127.0.0.1 通过在主机文件127.0.0.1 MyComputer中添加条目,您可以指示您的PC如果某人ping或浏览到mycomputer,则将该名称解析为127.0.0.1的地址。

You could type 127.0.0.1 Mushrooms in the host file and this would work in the same way. 您可以在主机文件中键入127.0.0.1 Mushrooms,这将以相同的方式工作。

As another example in the host file you could type 173.194.67.106 bananas Then open a web browser and type bananas, which should then take you to the google web site. 作为主机文件中的另一个示例,您可以键入173.194.67.106 bananas,然后打开Web浏览器并键入bananas,然后应将其带到google网站。

The link below should help you to understand this more. 以下链接应帮助您进一步了解这一点。

http://www.bleepingcomputer.com/tutorials/hosts-files-explained/ http://www.bleepingcomputer.com/tutorials/hosts-files-explained/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM