我正在尝试使用Microsoft odbc创建gitlab管道连接,但是我无法使用isql
进行连接,我在做什么错了?
这是我的.gitlab-ci.yml
:
stages:
- .pre
- database
- .post
before_script:
- curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
- curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list
- apt-get update -qy
- ACCEPT_EULA=Y apt-get install unixodbc-dev -qy
- ACCEPT_EULA=Y apt-get install msodbcsql17 -qy
- apt-get install python3-dev -qy
- pip install pyodbc
#database stage
database:
image: "python:3.7"
services:
- microsoft/mssql-server-linux
variables:
ACCEPT_EULA: Y
SA_PASSWORD: T4qu3p4r!l
stage: database
script:
- export DATABASE_NAME="GitLabDjango"
- export DATABASE_DSN="MYSERVER"
- export DATABASE_PORT=1433
- echo [MYSERVER] > /etc/odbc.ini
- echo "Description = MYSERVER" >> /etc/odbc.ini
- echo "Drive = ODBC Driver 17 for SQL Server" >> /etc/odbc.ini
- echo "Server = localhost,1433" >> /etc/odbc.ini
- cat /etc/odbc.ini
- isql MYSERVER sa T4qu3p4r!l -v
我收到此错误:
[ISQL]ERROR: Could not SQLConnect
[IM002][unixODBC][Driver Manager]Data source name not found and no default driver specified