How to get the Job ID and Run ID and save into a database

Mohit_m
Databricks Employee
Databricks Employee

We are having Databricks Job running with main class and JAR file in it. Our JAR file code base is in Scala. Now, when our job starts running, we need to log Job ID and Run ID into the database for future purpose. How can we achieve this?