Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ODBC connection string does not recognise DNS alias

Posted on 2007-11-27
6
Medium Priority
?
4,248 Views
Last Modified: 2012-08-14
In some of our Excel workbooks with external data queries to SQL Server 2000 setup, the connection string for the table is:

ODBC;DRIVER=SQL Server;SERVER=SQL1;UID=Fred;APP=Microsoft Office 2003;WSID=PC1;DATABASE=DB1;Trusted_Connection=Yes

The above worked ok until we renamed the SQL1 instance to something else (eg. SQLServer) and introduced a DNS alias called 'SQL1'.    All other apps connect ok using the new DNS alias, 'SQL1'.   However,  since the change, some spreadsheets with external data queries have been failing with the message:  

[Microsoft][ODBC SQL Server Driver][SQL Server] Could not find server 'SQL1' in sysservers.  Execute sp_addlinedserver to add the server to sysservers

It's of course true that 'SQL1' isn't in syservers because the server was renamed to something else.  However, the new DNS alias 'SQL1' points to what used to be the SQL1 SQL Server instance (eg. 'SQLServer').    It appears to be that ODBC isn't attempting to find the server via DNS.

For now, we are working around the problem by changing the connection strings not to use the 'SQL1' DNS alias but we prefer to use the alias (eg. easier DR failover).   Can someone tell me if this can be fixed so that these spreadsheet connections to SQL Server use the DNS alias?

AustinSeven  
0
Comment
Question by:AustinSeven
[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
  • 2
  • 2
  • 2
6 Comments
 
LVL 31

Expert Comment

by:James Murrell
ID: 20356893
0
 
LVL 25

Expert Comment

by:imitchie
ID: 20356896
here's what's happening:
the DNS alias "SQL1" will get you to the IP address for the new server, "SQLServer"
however, once you hit the server, ODBC/Excel is selecting things from the server named "SQL1" which obviously doesn't exist.
one way to fix this is to update the servername

sp_dropserver 'SQL1'
sp_addlinkedserver ....

check for sp_addlinkedserver and sp_dropserver in Books Online. Also, if you are ever going to "rename a SQL Server", check Google for the correct steps to do it. you need to update system tables as well.
0
 
LVL 31

Expert Comment

by:James Murrell
ID: 20356930
for moving sql server this is a must read http://support.microsoft.com/default.aspx?scid=KB;EN-US;q224071&
0
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!

 
LVL 10

Author Comment

by:AustinSeven
ID: 20356932
cs97jjm3,
Thanks for the link although I couldn't find anything about this particular problem.

imitchie,
I already had done the usual sp_dropserver 'SQL1', sp_addlinkedserver stuff as part of the server rename.   That isn't the issue.   The server rename was done correctly and all apps connect properly.  Sysservers contains references to the new server name as expected.   The issue is that ODBC connection strings from excel don't pickup the DNS alias.   Maybe there's a parameter that can be inserted into an ODBC connection string to make it reference DNS.  Not sure.

AustinSeven
0
 
LVL 25

Accepted Solution

by:
imitchie earned 2000 total points
ID: 20357046
What I mean is that the ODBC Jet driver is not only connecting to the server, but executing specific code that will reference the SERVERNAME directly.

[Microsoft][ODBC SQL Server Driver][SQL Server] Could not find server 'SQL1' in sysservers.  Execute sp_addlinedserver to add the server to sysservers

This reference to sysservers comes from SQL Server, so I'm 100% positive that it has in fact resolved the DNS name. You just need to create a SQL alias to SQL1 in sysservers (link name = SQL1, target = actual server) to make Excel/ODBC work
0
 
LVL 10

Author Comment

by:AustinSeven
ID: 20357352
imitchie,

>This reference to sysservers comes from SQL Server, so I'm 100% positive that it has in fact resolved >the DNS name. You just need to create a SQL alias to SQL1 in sysservers (link name = SQL1, target = >actual server) to make Excel/ODBC work
You're right, I see that now thank you.   I added a new Linked Server called 'SQL1' aliased to the actual name of the server and the offending spreadsheets connected ok (no need for dropping any server in sysservers).    I don't fully understand this yet but it appears that the ODBC Jet Driver looks down the list of 'servers' in sysservers until it finds the name referenced in the connection string.  However,  I thought that the ODBC Jet Driver would just try to connect to the target SQL server and not try to match the SERVER parameter in the connection string with entries in SYSSERVERS... After all, it has already connected to the requried server as you pointed out so why bother doing this?   It just seems like a redundant step that causes problems.

Thanks,
AustinSeven
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
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 the fundamental information of how to create a table.

670 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