Configure database with keycloak using database service name

I have already successfully configured a database with keycloak using database SID and following configuration. However, I have to configure another database which doesn’t has SID but with a service name in docker-compose file. I couldn’t find a way to configure database to keycloak using it’s service name.

Configuration using SID in docker-compose file

         - name: DB_VENDOR
           value: ORACLE
         - name: DB_ADDR
           value: xxx.xx.xx.xxx
         - name: DB_PORT
           value: "1521"
         - name: DB_DATABASE
           value: sid_name
         - name: DB_USER
           value: db_user_name
         - name: DB_PASSWORD
           value: ******

When I tried to use service name instead of SID as value for DB_DATABASE it gave following error.

Caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

Appreciate your kind help to solve this issue.

Thank you in advance..

Source: StackOverflow