SQL Server config file uses Placeholder instead of Default for Port Number causing connection failures

Per a request from @flamber to file a summary bug for thread #5165

BACKGROUND

I was attempting to add an SQL Server database and began receiving timeout errors when attempting to save. I debugged by putting the jar file on a server which I knew had access to the database in question. After several abortive attempts, none of which worked, I happened to try something out of desperation.

  • The Port Number shows a default of 1433.
  • I hand entered 1433 into the Port Number field.

The problem was solved.

Results of investigation

It turns out that the problem lies in metabase/modules/drivers/sqlserver/resources/metabase-plugin.yaml at master · metabase/metabase · GitHub.

The YAML configuration shows:

connection-properties:
   - host
   - merge:
       - port
       - placeholder: 1433

When we compare this to the Oracle configuration file, we notice that placeholder was used instead of default:

connection-properties:
    - host
    - merge:
        - port
        - default: 1521

This is an issue because the visual appearance of both default and placeholder is identical which can easily lead to attempting to diagnose connectivity issues with SQL Server if the port number has not been physically entered.

Discussion on the thread indicates that the selection of placeholder may have been to theoretically support dynamic ports on SQL Server. However, this is a non-starter because, according to @AndrewMBaines,:

I didn’t think the JDBC supported dynamic ports, just the ODBC that Metabase doesn’t use. I’ve had to change dynamic ports to fixed for SQL with Metabase.

Recommendation

My recommendation is to change the key from placeholder to default because there is no reason to confuse the user to support a protocol which the underlying framework doesn't support.

1 Like