ConnectionString issues - SQL Server 2008 on Windows 2008

不想你离开。 提交于 2019-12-25 03:46:10

问题


We have a third party program that used to run on Windows 2003 against SQL Server 2000 database (app and db are on same machine). We are trying to migrate/install it on Windows 2008/ SQL Server 2008.

The connection string as specified does not seem to allow it to connect it to SQL Server (see below)

    <Configuration name="PROG">
    <ADOConnection>
        Provider=SQLOLEDB.1;Persist Security Info=False;User Id=sa;Pwd=p@ssw0rd;Initial Catalog=DB_NEW;Data source=servername
    </ADOConnection>
</Configuration>

I tried an alternate one and that also does not work

<Configuration name="PROG">
     <ADOConnection>    
Provider=SQLNCLI10.1;Persist Security Info=False;Initial Catalog=DB_NEW;Data Source=servername;Uid=sa; Pwd=p@ssw0rd;

I was able to use the one below to successfully connect the application to a SQL Server 2008 database on Windows 2003

<Configuration name="PROG">
    <ADOConnection>
        Provider=SQLOLEDB.1;Persist Security Info=False;User Id=sa;Pwd=p@ssw0rd;Initial Catalog=DB_NEW;Data source=servername
    </ADOConnection>

What is the right syntax to get the application to connect to a SQL Server 2008 on Windows 2008 server?


回答1:


You can check which provider version(s) are installed by looking in the registry: HKEY_CLASSES_ROOT\SQLNCLI10\Clsid

HKEY_CLASSES_ROOT\SQLNCLI10.1\Clsid (for version 10.1 etc)

The SQLNCLI10 (sql server native client) name is an alias to the latest version installed on the computer. On your 2003 box you will also find entries for sqloledb in the registry which you likely won't have installed on the 2008 box.

I would expect that the following should work: Provider=SQLNCLI10;Persist Security Info=False;User Id=sa;Pwd=p@ssw0rd;Initial Catalog=DB_NEW;Data source=servername

For more info on the formatting of the connection string and the various provider see: this connectionstring site



来源:https://stackoverflow.com/questions/6553554/connectionstring-issues-sql-server-2008-on-windows-2008

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!