The SQL Server ODBC driver uses the SQL Server Browser or the SQL Server 2000 listener service to find out what TCP port SQL Server is listening on. If the SQL Server Browser or listener service is not running and active, the SQL Server ODBC driver will be unable to open a connection for this purpose and the "Failed to get datagram from socket" error displays.
On the SQL Server machine, "SQL Server Browser" will be listed in the output of the net start
command, if the SQL Server Browser is running. If net start
shows that the SQL Server Browser service is running, the service may not be active. In the SQL Server Configuration Manager, the Active option must be set to Yes in the Advanced SQL Server Browser property tab. (The SQL Server Browser service must be restarted before any change to this setting takes effect.)
If you're connecting to SQL Server through a firewall, the firewall needs to allow connections through:
If UDP port 1434 is not open, the firewall blocks the connection when the SQL Server ODBC driver attempts to discover the SQL Server port and the 'Failed to get datagram from socket' error will display.
Because the SQL Server Browser or listener accepts unauthenticated UDP requests, it may have been turned off as a security measure, and your database administrator will have configured each SQL Server instance to listen on a specific TCP port. You need to specify this port number with the Port
setting. For example, if SQL Server is listening on port 1500, add this line to the data source in odbc.ini
:
Port = 1500
The "Failed to get datagram from socket" error also displays if you try to connect to a hidden SQL Server instance. You need to specify the port that the hidden instance is listening even though the SQL Server Browser or listener may be running.