In this article I will discuss about PostgreSQL database and how to use it through Java code. PostgreSQL, or simply Postgres, is an Object-Relational Database Management System (ORDBMS). Its primary function is to store data, securely and supporting best practices, and retrieve it later, as requested by other software applications, be it those on the same computer or those running on another computer across a network (including the Internet).
Postgres comes with plenty of drivers for the developer to use it through the most used languages, such as Java, C++, PHP, Python, .NET languages, and even Common LISP.
In this article, I will show how to use use Postgres through Java, i.e. connecting to the database, creating tables through Java code, execute search (select) queries and inserting/modifying the records on the table.
These are the steps I will follow in this article:
- Download and install PostgreSQL and pgAdmin 3
- Use pgAdmin 3 to create databases and tables
- Connect to the PostgreSQL database using Java code
- Create a simple Helper class to communicate with the database