'Cannot connect to SQL Server Express but I can with SQL Management Studio
I have launched a SQL Server Express container via docker-compose. This launches all fine and I can connect with my locally installed SQL Management Studio using the credentials. But when I try to connect from R, I get the following error:
Error: nanodbc/nanodbc.cpp:1021: 01000: [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()).
docker-compose.yml
services:
sql-server:
image: mcr.microsoft.com/mssql/server:2019-latest
restart: unless-stopped
hostname: sql-server
container_name: sql-server
ports:
- "1433:1433"
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=foobar
- MSSQL_PID=Express
volumes:
- mssqldata:/var/opt/mssql
volumes:
mssqldata:
I use the following connection code in R:
conn <- DBI::dbConnect(odbc::odbc(),
Driver = "SQL Server",
Server = "localhost\\SQLEXPRESS",
UID = "sa",
PWD = "foobar"
)
Is anybody aware of a setting within SQL Server Express that needs to be set to allow access from R or something along those lines?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
