我想使用R连接到SQL Server,并尝试使用RODBC软件包。 在odbcConnect函数中,我对参数感到困惑: -
对于服务器,我去了regedit和odbc并看到了SQL Server Native Client 10.0
对于数据库,我编写了Tableau(这是名称)
以下是我写的代码: -
cn <- odbcDriverConnect(connection="Driver={SQL Server Native Client 10.0};server=.;database=Tableau;trusted_connection=yes;uid=SQL_User;pwd=Greentableau!")
但我在代码中遇到错误: -
Warning messages:
1: In odbcDriverConnect(connection = "Driver={SQL Server Native Client 10.0};server=.;database=Tableau;trusted_connection=yes;uid=SQL_User;pwd=Greentableau!") : [RODBC] ERROR: state 08001, code 2, message [Microsoft][SQL Server Native Client 10.0]Named Pipes Provider: Could not open a connection to SQL Server [2].
2: In odbcDriverConnect(connection = "Driver={SQL Server Native Client 10.0};server=.;database=Tableau;trusted_connection=yes;uid=SQL_User;pwd=Greentableau!") :[RODBC] ERROR: state HYT00, code 0, message [Microsoft][SQL Server Native Client 10.0]Login timeout expired
3: In odbcDriverConnect(connection = "Driver={SQL Server Native Client 10.0};server=.;database=Tableau;trusted_connection=yes;uid=SQL_User;pwd=Greentableau!") :[RODBC] ERROR: state 08001, code 2, message [Microsoft][SQL Server Native Client 10.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
4: In odbcDriverConnect(connection = "Driver={SQL Server Native Client 10.0};server=.;database=Tableau;trusted_connection=yes;uid=SQL_User;pwd=""""!") :
ODBC connection failed
有人可以推荐任何解决方案吗?我不太了解错误