Postgres connection fails on "JDBC invalid port number" after upgrading metabase.jar

By replacing the metabase.jar file, we upgraded Metabase from v0.32.5 to v0.49.14. However, after the upgrade, the metabase.service fails to start. On the step of verifying postgres database connection, there are errors saying "WARN util.PGPropertyUtil :: JDBC URL invalid port number: $MB_DB_PORT".

We are new to Metabase upgrade, so we highly appreciate any hints and suggestions.

Details:

  1. The error message in /var/log/message:
...
Jun 11 14:02:47 metabasev metabase: 2024-06-11 14:02:47,900 INFO db.setup :: #033[36mVerifying postgres Database Connection ...#033[0m
Jun 11 14:02:47 metabasev metabase: 2024-06-11 14:02:47,955 WARN util.PGPropertyUtil :: JDBC URL invalid port number: $MB_DB_PORT
Jun 11 14:02:47 metabasev metabase: 2024-06-11 14:02:47,954 WARN util.PGPropertyUtil :: JDBC URL invalid port number: $MB_DB_PORT
...
  1. The metabase.env file:
MB_DB_TYPE="postgres"
MB_DB_DBNAME="Metabasev"
MB_DB_PORT="5432"
MB_DB_USER="metabasev_user"
MB_DB_PASS="metabasev_user"
MB_DB_HOST="localhost"
MB_DB_CONNECTION_URI="postgres://$MB_DB_HOST:$MB_DB_PORT/$MB_DB_DBNAME?user=$MB_DB_USER&password=$MB_DB_PASS&prepareThreshold=0"

It’s either a connection URI or port/host/name… etc

I would remove the URI one and restart

1 Like

Thank you, @Luiggi , and your advice helps.

Commented out the line of variable MB_DB_CONNECTION_URI, and the new version started successfully. So now the metabase.env file is like the sample below.

MB_DB_TYPE="postgres"
MB_DB_DBNAME="Metabasev"
MB_DB_PORT="5432"
MB_DB_USER="metabasev_user"
MB_DB_PASS="metabasev_user"
MB_DB_HOST="localhost"
# MB_DB_CONNECTION_URI="postgres://$MB_DB_HOST:$MB_DB_PORT/$MB_DB_DBNAME?user=$MB_DB_USER&password=$MB_DB_PASS&prepareThreshold=0"