The container runs fine on my local machine, but when running on the server the ODBC Driver does not show up in the list of servers. I should not need a DSN as I don’t have one on my local machine. has anyone run across this issue. Possibly a server setting?
Error: InterfaceError(‘IM002’, ‘[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)’)
Dockerfile:
FROM python:3.10.10-windowsservercore-1809 as base
WORKDIR "C:\src"
COPY vc_redist.x64.exe c:/
COPY msodbcsql_18.3.2.1.msi c:/
RUN c:\\vc_redist.x64.exe /install /passive /norestart
RUN MSIEXEC /UNREGISTER
RUN MSIEXEC /REGSERVER
RUN msiexec.exe /i C:\\msodbcsql_18.3.2.1.msi /norestart /qn /quiet
/passive IACCEPTMSODBCSQLLICENSETERMS=YES
#RUN apt-get install -y C:\\msodbcsql_18.3.2.1.msi
#RUN msiexec /quiet /passive /qn /i msodbcsql.msi
IACCEPTMSODBCSQLLICENSETERMS=YES ADDLOCAL=ALL
#RUN Start-Process 'c:/msodbcsql_18.3.2.1.msi' '/qn /norestart /L*V "odbc.log"' -PassThru | Wait-Process;
RUN pip install "poetry==1.4.0"
COPY my.lock .
COPY my.toml .
RUN poetry config virtualenvs.create true
RUN poetry install --no-interaction --no-ansi
COPY ["myPgm.py", "."]
COPY ["myJsonFile.json", "."]
CMD ["poetry","run",
"python","myPgm.py","Param1","Param2","Param3","Param4","Parm5"]
Output:
On my machine (both drivers found):
2023-12-20 14:49:49.511504 Installed Driver #1 ... SQL Server
2023-12-20 14:49:49.511504 Installed Driver #2 ... ODBC Driver 18 for SQL Server
On Server (Only SQL Server default driver found):
2023-12-20 14:09:36.276160 Installed Driver #1 ...SQL Server