我是 C++ 的初学者,我在 Linux 上使用 soci 库连接 SQL Server 的问题,我的代码是这个,但我有错误,我没有找到解决我的问题的方法,我的代码是:
我有错误:
[unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL state IM002)
这是代码:
try{
soci::session sql("odbc","DSN=ODBC;UID=sa;PWD=sa123; Connection Driver=TDS;Database=ReportServer; Server=192.168.1.52;Port=1433;");
}
catch(soci::odbc_soci_error const & e){
cout<<"start error";
cout<<e.odbc_error_code()<<endl;
cout<<e.what();
}