So far, we have used a console to send SQL statements to the database. The same statements could be executed from Java code using the JDBC API, but tables are created only once, so there is not much sense in writing a program for a one-time execution.
But managing data is another matter. That is the primary purpose of a program we are going to write now. In order to do that, first, we add the following dependency to the pom.xml file because we have installed PostgreSQL 9.6:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.2</version>
</dependency>