setwd("/mnt/mountpoint/abc/")
sqlServerConnString <- "SERVER=server;DATABASE=sqldwdb;UID=xyz;PWD=abc;"
sqlServerDataDS <- RxSqlServerData(sqlQuery = "SELECT * FROM xyz",
connectionString = sqlServerConnString)
sqlServerDataDF <- rxImport(sqlServerDataDS)
This is my code. I am getting the followin error in R
[unixODBC][Driver Manager]Can't open lib 'SQL Server' : file not found
[unixODBC][Driver Manager]Connnection does not exist ODBC Error in SQLDisconnect Could not open data source.Error in doTryCatch(return(expr), name, parentenv, handler) : Could not open data source.
I have installed MSSQL and unixODBC driver on my linux machine and it is getting refelected in /etc/odbc.ini file too
Can someone please help me in this?
In my case Zaynul answer didn't worked, unfortunately. But it helped me to find another way. I am using sqlalchemy and I could sucessfully create a connection passing the driver path:
EDIT: I was not satisfied with that solution, since the file name of driver could change, so I managed to change the library used to connect do pymssql.
engine = create_engine('mssql+pymssql://sa:******@localhost:1433/dbCVServer')
and it worked well too. =]
EDIT 2: Another discovery, connecting to a named instance, for those using sql express, for instance.
engine = create_engine('mssql+pymssql://mssql+pymssql://localhost\SQLEXPRESS/dbCVServer')
I got the same error when i put below code for connection to MSSQLSERVER
It throws to me
why this Error thrown? Answer: when we fail to put proper ODBC version name on Driver value.
From where we can get Driver ODBC version name
inside "/etc" folder you will find "odbcinst.ini" file open it and check the version name
so i got ODBC Driver name from here , it will be "ODBC Driver 17 for SQL Server" Then i modify my connection string
And it works fine