繁体   English   中英

无法从R连接到Azure虚拟机数据库

[英]unable to connect to azure vm database from R

我正在尝试从R连接到在Microsoft Azure中的虚拟机上运行的Microsoft SQL Server数据库。

这是我的SQL Server的样子 在此处输入图片说明

这是我的连接字符串

library(RODBC)
channel = odbcConnect(dsn="something.cloudapp.net",uid="myusername",pwd="mypassword");

但是,我不断收到此错误

Warning messages:
1: In odbcDriverConnect("DSN=servername.cloudapp.net,1433;UID=myusername;PWD=mypassword") :
  [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
2: In odbcDriverConnect("DSN=servername.cloudapp.net,1433;UID=myusername;PWD=mypassword"):
  ODBC connection failed

为什么我不断收到此错误?

尝试使用更灵活的odbcDriverConnect函数,如下所示:

odbcDriverConnect('driver={SQL Server};Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;')

为便于阅读,此处带有回车符:

odbcDriverConnect(
    'driver={SQL Server};
     Server=myServerAddress;
     Database=myDataBase;
     User Id=myUsername;
     Password=myPassword;')

也可以看看:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM