Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to SqlServer #47

Open
becio opened this issue Jun 21, 2022 · 4 comments
Open

Unable to connect to SqlServer #47

becio opened this issue Jun 21, 2022 · 4 comments

Comments

@becio
Copy link

becio commented Jun 21, 2022

it looks like the QODBC Driver is missing from current docker image:

QSqlDatabase: QODBC driver not loaded
QSqlDatabase: available drivers: QSQLITE QSPATIALITE
@wlorenzetti
Copy link
Member

For SqlServer you should make build for container base image whit this dockerfile: https://github.com/g3w-suite/g3w-suite-docker/blob/dev/Dockerfile.g3wsuite-deps.ltr.mssql.dockerfile

And after rebuild main g3w-suite container image.

@becio
Copy link
Author

becio commented Jun 22, 2022

I tried

docker build -t g3wsuite/g3w-suite-deps-ltr:dev -f Dockerfile.g3wsuite-deps.ltr.mssql.dockerfile .

but it breaks at the line

[ 4/11] RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-key 46B5721DBBD2996A &&     echo "deb [arch=amd64] https://qgis.org/ubuntu-ltr bionic main" >> /etc/apt/sources.list &&     apt update && apt install -y python3-qgis qgis-server:

some packages have unmet dependencies, python3-qgis and qgis-server

@wlorenzetti
Copy link
Member

Hi @becio sorry for reply too late!
Were you able to connect with SqlServer?

@becio
Copy link
Author

becio commented Nov 17, 2022

I solved it with this dockerfile:

FROM g3wsuite/g3w-suite:dev

RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add
RUN curl https://packages.microsoft.com/config/ubuntu/$(grep -Po '(?<=^VERSION_ID=")(\d+\.\d+)' /etc/os-release)/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt-get update && ACCEPT_EULA=Y apt install -y msodbcsql18 mssql-tools18
#RUN apt-get install -y unixodbc-dev
RUN apt-get install -y unixodbc odbcinst freetds-bin tdsodbc
RUN apt-get install -y libqt5sql5-odbc libqt5sql5-tds
RUN echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
RUN echo "[FreeTDS]" >> /etc/odbcinst.ini && \
    echo "Description=v0.91 with protocol v7.2" >> /etc/odbcinst.ini && \
    echo "Driver=/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so" >> /etc/odbcinst.ini

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants