Create JDBC Connection using Properties File

In this tutorial we will create jdbc connection using properties file. Properties file is a convenient way to store the data in key value pair. in properties file both key and values are of String type. We are storing the connection parameters in the properties file because we can manage the properties file very easily.
Project Structure:-

create jdbc connection using properties file

code to create jdbc connection using properties file:-

jdbc.properties

output:-

using properties file to store connection parameters is easy to maintain because you don’t need to edit, compile, rebuild the connection details in class file.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.