I’m currently learning JDBC to operate database. This article is an note of what I learnt.
What Is JDBC
Java™ database connectivity (JDBC) is the JavaSoft specification of a standard application programming interface (API) that allows Java programs to access database management systems. The JDBC API consists of a set of interfaces and classes written in the Java programming language.
This helps Java developer to write code more easily when coming to different database. You don’t need to write a new code to adapt the different database, it can be done in almost the same code using JDBC.
How to connect to DB
read config information
We use a config file to set user and password and database URL information, so that when we change database, we don’t need to compile the code again, and we separate the code and data.
Because we use Properties to get the file, we can store file in jdbc.properties in src folder.