使用DSN连接设置SQL链接服务器

时间:2011-08-17 18:41:08

标签: sql sql-server sql-server-2005 sql-server-2008

我们在本地系统上安装和配置了Ctree数据库ODBC驱动程序。我们有DSN连接即可使用。

使用DSN Connection,我需要建立SQL链接服务器连接。我是SQL链接服务器连接设置的新手。我正在寻找更多文章和帮助,这可以帮助我建立与DSN连接的SQL链接服务器连接设置。

1 个答案:

答案 0 :(得分:0)

使用类似的东西(链接服务器的名称将是CTREESRV):

USE [master]
GO
EXEC master.dbo.sp_addlinkedserver @server = N'CTREESRV', @srvproduct=N'Ctree', @provider=N'MSDASQL', @datasrc=N'DSN_NAME_HERE', @location=N'SOMETHING', @provstr=N'DNS=DSN_NAME_HERE;UID=DSN_USRNAME_HERE;PWD=DSN_PASSWD_HERE', @catalog=N'DATABASENAME_HERE'

GO
EXEC master.dbo.sp_serveroption @server=N'CTREESRV', @optname=N'collation compatible', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'CTREESRV', @optname=N'data access', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'CTREESRV', @optname=N'dist', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'CTREESRV', @optname=N'pub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'CTREESRV', @optname=N'rpc', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'CTREESRV', @optname=N'rpc out', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'CTREESRV', @optname=N'sub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'CTREESRV', @optname=N'connect timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'CTREESRV', @optname=N'collation name', @optvalue=null
GO
EXEC master.dbo.sp_serveroption @server=N'CTREESRV', @optname=N'lazy schema validation', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'CTREESRV', @optname=N'query timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'CTREESRV', @optname=N'use remote collation', @optvalue=N'true'
GO
USE [master]
GO
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname = N'CTREESRV', @locallogin = NULL , @useself = N'False'
GO