How to create an alias for IP address for JDBC connection?
Add the alias to the file /etc/hosts with a line like this:

123.123.123.123 db

Where 123.123.123.123 should be substituted with your IP-address and db must match the name given as alias in the JDBC connection.

After editing the file, run the following command in the Terminal:

sudo killall -HUP mDNSResponder

This will reload the hosts file.