Not found error (MSSQL)

“SQL server node fails to connect to - could not connect (sequence)”

Not sure what I’m missing if;
*SQL server running
*I can ping from cmd
*I’ve opened up in tcp/ip settings (on sql server)
*Have put as such in Edge Workflow designer; including user and pass
*I’m even running other programs on the PC that can successfully connect
*And yup GEA is running and showing online

But I will say I’m not sure where the finer details of a connection go; like database server (above database name, which is a field in the SQL node).

Hi @emcdee !

I assume you’re using this in an Edge workflow? If so, (localhost) will loopback within the Docker container. If you’re running SQL on the same host machine, you’ll need to use the host IP address in the SQL Node configuration.

Please let us know if you have any other questions.

Ah yes, am using docker in Ubuntu on a Win 10 machine.

So that’s curious, because works independently, even if docker isn’t running. So how to use a ‘local’ address and not get stuck in docker?

Because I won’t know the DHCP or whatever IP addr every time the machine boots up. And I’d like to keep a standard like in the ‘regular’ Win environment.

By the way, I did try opening up ‘static’ TCP ports in SQL server settings but still no go via debug output of SQL node in GEA workflow (again, running in a Ubuntu docker container).

But yea, local connection to DB on has been working (hasn’t changed).

I did --network=“host” within the docker run cmd and still getting ‘notFoundError’ in debug output of GEA…

We’re putting together a comprehensive example for you now and should have it posted here later today.

Oh that’s much appreciated, thank you.

I think this is the key piece that is missing:

You need to use the hostname of host.docker.internal.

I verified this running the GEA out of a Docker container on my Macbook and interacting with the mysql service I have running locally on my host machine. Attached is an edge workflow as a proof of concept; bear in mind you will need to alter the values in the Virtual Button payload to match your database name, table name, user, and password. You shouldn’t have to change the host and the port if you are using default settings.

Attached is a simple proof of concept workflow you can use as a starting point. It was not necessary to start the container with the --network host setting in my testing.

Please let me know if you run into any issues with this.

sql-test-develop.flow (2.1 KB)

We’ve been working with the original poster outside of this thread to resolve this issue. Just wanted to follow up on this thread in case anyone else out there runs into something similar.

First, note that when using Windows Subsystem for Linux (WSL) 2 and running Docker, there are several prerequisites and best practices to consider. These are outlined in Docker’s documentation.

Since WSL2 runs in a virtual network created by the Windows host, referencing localhost from inside WSL2 will not resolve to the host. Here’s a StackExchange thread that describes this in greater detail.

To access the local host IP address from within your WSL2 Docker container, run the container with the environment variable -e "LOCAL_HOST=$(hostname).local" and the --network host flag.

In this case, since we’re connecting to MySQL on the host machine, in the Edge device workflow’s SQL Node, we use this as the SQL Server Address: {{agentEnvironment.LOCAL_HOST}}.

This should allow connection from the WSL Docker container to the host machine’s SQL server.

1 Like