Decode JDBC URLs

Dr. Viktor Walter-Tscharf1 MIN. LESEZEIT
Decode JDBC URLs

If you are seeking to get a username, password, database, port, host out of the JDBC URL this article is the right one for you.

Photo by Jan Antonin Kolar on Unsplash

In general the URL structure is defined as follows:

jdbc:postgresql://<username>:<password>@<database_host>:<port>/<database_name>

An Example for the URL on AWS is the following:

jdbc:postgres://kauzniowwod:d0&55b$22c&now!893@ec2–216–235.eu-west-1.compute.amazonaws.com:5432/d45qed93iqi8tq

Decoding:

Now let's decode the previous example.

jdbc -> is the protocol.
postgres -> is the driver which the client should use.
kauzniowwod -> is the username.
d0&55b$22c&now! -> is the password.
ec2–216–235.eu-west-1.compute.amazonaws.com -> is the hostname.
5432 -> is the port which is used.
d45qed93iqi8tq -> is the database name, which is used.