当我在ubuntu / linux R上尝试我的代码时,我得到以下错误
> library('RODBC')
> sname <- "BLAH"
> dbname <- "BB"
> dbhandle <- odbcDriverConnect(paste("driver={SQL Server};server=", sname, ";database=", dbname, ";trusted_connection=true", sep = ""))
Warning messages:
1: In odbcDriverConnect(paste("driver={SQL Server};server=", sname, :
[RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver Manager]Data source name not found, and no default driver specified
2: In odbcDriverConnect(paste("driver={SQL Server};server=", sname, :
ODBC connection failed
但是相同的代码在Windows R上运行正常。我在windows上使用RStudio而在linux / ubuntu上使用命令提示符
> library("RODBC", lib.loc="~/R/win-library/3.1")
>
> sname <- "BLAH"
> dbname <- "BB"
> dbhandle <- odbcDriverConnect(paste("driver={SQL Server};server=", sname, ";database=", dbname, ";trusted_connection=true", sep = ""))
答案 0 :(得分:1)
我遇到了这个问题并通过Windows和Linux版本之间的以下修改来解决它:
Windows上的:
public class CategoryTextColorConverter : MvxColorValueConverter<ShowCategory>
{
protected override MvxColor Convert(ShowCategory value, object parameter, CultureInfo culture)
{
if (value == ShowCategory.AllShows)
{
return MvxColors.Blue;
}
return MvxColors.Red;
}
}
linux上的:
dbhandle <- odbcDriverConnect(paste("driver={SQL Server};server=", ...
区别在于声明驱动程序,有/无花括号以及dbhandle <- odbcDriverConnect(paste("driver=SQLServer;server=", ...
和SQL
之间的空格
仍在寻找为什么的解释,但这有效...