As stated by zero323 you can use the spark-submit command from the link
./bin/spark-submit \
--class <main-class>
--master <master-url> \
--deploy-mode <deploy-mode> \
--conf <key>=<value> \
... # other options
<application-jar> \
[application-arguments]
Here, conf is used to pass the Spark related configs which are required for the application to run like any specific property(executor memory) or if you want to override the default property which is set in Spark-default.conf.
As far as your use case is concerned you want to pass the IP to the application to connect to database then you can use the [application-arguments] which are passed after the JAR.
When you set up your main as:
def main(args: Array[String])
Then you can accept anything as an argument given after .jar line.
Please refer for more details