postgresqldockerodbccratedb

How to configure PostgreSQL ODBC Driver


I have a database on Crate DB. The database program is started through docker-compose.yml file. It is running on http://192.168.99.100:4200 (this is the docker machine's IP with the Crate's port)

I want to connect the Crate DB with Power BI. When I try to configure the PostgreSQL ODBC Driver, I don't know what to type on "Server" field.

So far I've tried "localhost", "127.0.0.1","0.0.0.0", "192.168.99.100" but none of these works.

So my question is, which IP address should I type on the "server" field?

connectionError


Solution

  • The setup seems correct. Make sure the port 5432 is correctly published. Assuming you're using the official cratedb image, the exposed ports in Dockerfile used to assemble the image are the following:

    # http: 4200 tcp
    # transport: 4300 tcp
    # postgres protocol ports: 5432 tcp
    EXPOSE 4200 4300 5432
    

    Therefore, in order to access those services remotely you have to publish their corresponding ports. In docker-compose.yml configure the port mappings if you haven't already done so:

    version: "3.5"
    
    services:
      cratedb:
        image: crate
        ports:
           - 5432:5432
           - 4200:4200
           - 4300:4300
    

    More about port mappings in the ports section of the Compose file reference. Now you should be able to connect using the ODBC PostgreSql driver to the IP address of the host (i.e. 192.168.99.100) and port 5432.

    In alternative you could run the container with port bindings:

     docker run -d  -p 4200:4200 -p 5432:5432 -p 4300:4300 crate
    

    If you still can connect to the database, check the firewall settings.