Category : sql-server

What I’m trying to do is initiate a Microsoft SQL Server container and mount an existing database using Docker Volumes. I want any change that gets done through the Docker component to affect the same database as I can access with SQL Server directly. version: "3.9" services: sql-server-db: container_name: sql-server-db image: mcr.microsoft.com/mssql/server:2019-latest volumes: – ./data:/var/opt/mssql/data ..

Read more

I’m running SQL Server in a Linux container. When the container starts, I’d like some initialization and create a database using Powershell Core. My Dockerfile looks like this: FROM mcr.microsoft.com/mssql/server:2017-latest ENV ACCEPT_EULA="Y" ` DATA_PATH="./data" ` sa_password="[email protected]" VOLUME ${DATA_PATH} WORKDIR ./init RUN apt-get update RUN apt-get install -y powershell COPY SomeFolder/Initialize-Database.ps1 . CMD pwsh ./Initialize-Database.ps1 -sa_password ..

Read more

While running the below query on windows cmd docker exec -it %containerName% /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P %dbPassword% -Q ‘ALTER DATABASE MyTest SET READ_COMMITTED_SNAPSHOT ON;GO’ I am getting error qlcmd: ‘DATABASE’: Unknown Option. Enter ‘-?’ for help. While when I am running /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P mypass -Q ‘ALTER DATABASE MyTest SET ..

Read more

i’m trying to connect my Django to en existing legacy MS SQL database. When im trying to run a sql on the database works fine: sql = ‘SELECT * FROM ‘ + db_name + ‘.INFORMATION_SCHEMA.TABLES’ connection_string = "driver=FreeTDS;server={};PORT={} database={};UID={};PWD={};TDS_Version=8.0;".format(db_host, db_port, db_name, db_user, db_password) conn = pyodbc.connect(connection_string, autocommit=True) for row in cursor.fetchall(): print(row) And i can ..

Read more

I am having difficulties with MSSQL server on Docker. I created the compose file and everything starts normally, but whenever I try to login, it fails. It won’t connect locally via docker exec command: sudo docker exec -it <container_id> /opt/mssql-tools/bin/sqlcmd -S localhost -U sa Password: Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : ..

Read more

Before anyone suggests using 2019 based container, SQL Server 2017 and CU26 will not install in a 2019 based container due to fact that 2019 based containers use codepage is 65001 and that cannot be changed.. Using this docker file # escape=` FROM mcr.microsoft.com/windows/servercore:ltsc2016 # ADD https://github.com/microsoft/windows-container-tools/releases/download/v1.1/LogMonitor.exe LogMonitor.exe # SHELL ["powershell", "-Command", "$ErrorActionPreference = ‘Stop’; ..

Read more