Hi Freddy,
To use a PostgreSQL database with the DB Connector, you need to install some additional dependencies in your Docker container.
Also, for MS SQL Server, you need to install the ODBC driver.
To do this, I created a Dockerfile that installs the dependencies and installs Indicium with the following contents.
FROM mcr.microsoft.com/dotnet/aspnet:8.0
ENV ASPNETCORE_URLS http://+:5000
EXPOSE 5000
WORKDIR /app
COPY ./app /app/
# Install postgresql odbc driver
RUN apt-get update \
&& apt-get install unixodbc odbc-postgresql -y
# Install mssql odbc driver (https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server)
RUN apt-get update && apt-get install curl gpg -y \
&& curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg \
&& curl https://packages.microsoft.com/config/debian/12/prod.list | tee /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update && ACCEPT_EULA=Y apt-get install -y msodbcsql18
CMD dotnet Indicium.dll
I used a PostgreSQL database on Azure and disabled SSL for this test by turning off the `require_secure_transport` parameter.
In production you will probably want to use this, but for this test I disabled it to make it easier to connect to the database.
So, after spinning up a PostgreSQL database on Azure, I connected to it using the following settings in the DB Connector:
Driver={PostgreSQL ANSI};Server=xxxxxx.postgres.database.azure.com;Port=5432;Database=postgres;Uid=dvdbrink;Pwd=xxxxxxxxxx;
I just tested a simple query and it worked fine.
To connect to a MS SQL Server database, you can use the following settings in the DB Connector:
Driver={ODBC Driver 18 for SQL Server};Server=xxxxxx.database.windows.net;Database=ACME_IAM;Uid=dvdbrink;Pwd=xxxxx;
If you want to install additional ODBC drivers, you can do so by adding the scripts to the Dockerfile.
Hi @Freddy, did Dick's reaction help you out?