This is a Java tutorial for the PostgreSQL database. It covers the basics of PostgreSQL programming with Java.
What is PostgreSQL?
PostgreSQL is a general-purpose and object-relational database management system, the most advanced open-source database system. PostgreSQL was developed based on POSTGRES 4.2 at Berkeley Computer Science Department, University of California.
PostgreSQL was designed to run on UNIX-like platforms. However, PostgreSQL was then also designed to be portable so that it could run on various platforms such as Mac OS X, Solaris, and Windows.
PostgreSQL features highlights
PostgreSQL has many advanced features that other enterprise database management systems offer, such as:- User-defined types
- Table inheritance
- Sophisticated locking mechanism
- Foreign key referential integrity
- Views, rules, subquery
- Nested transactions (savepoints)
- Multi-version concurrency control (MVCC)
- Asynchronous replication
- Native Microsoft Windows Server version
- Tablespaces
- Point-in-time recovery
Technologies used
We use the below technologies in this tutorial:
- JDK - 1.8 or later
- PostgreSQL- 42.2.9
- IDE - Eclipse Neon
- JDBC - 4.2
Download PostgreSQL JDBC Driver
To connect to the PostgreSQL database server from a Java program, you need to have a PostgreSQL JDBC driver.
Add the PostgreSQL JDBC driver jar file to the project classpath.
For maven users:
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.9</version>
</dependency>
For Gradle users:
// https://mvnrepository.com/artifact/org.postgresql/postgresql
compile group: 'org.postgresql', name: 'postgresql', version: '42.2.9'
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.9</version>
</dependency>
// https://mvnrepository.com/artifact/org.postgresql/postgresql
compile group: 'org.postgresql', name: 'postgresql', version: '42.2.9'
Java PostgreSQL Tutorials and Examples
- Java - JDBC PostgreSQL Connection Example - In this tutorial, we will show you how to download PostgreSQL JDBC driver, and connect to the PostgreSQL database server from a Java program.
- Java - JDBC PostgreSQL Create Table Example - In this tutorial, we will show you how to connect to the PostgreSQL database server and how to create a table in a PostgreSQL database using a Java program.
- Java - JDBC PostgreSQL Insert Example - In this tutorial, you will learn how to insert data into a table in the PostgreSQL database using the JDBC API.
- Java - JDBC PostgreSQL Select Example - In this tutorial, you will learn how to query data from a table in the PostgreSQL database using the JDBC API.
- Java - JDBC PostgreSQL Update Example - In this tutorial, you will learn how to update data in a PostgreSQL database using the JDBC API.
- Java - JDBC PostgreSQL Delete Example - In this tutorial, you will learn how to delete data from a table in the PostgreSQL database using JDBC.
- Java - JDBC PostgreSQL Transaction Example - In this tutorial, you will learn about the JDBC PostgreSQL transaction using JDBC transaction API.
- Java - JDBC PostgreSQL Batch Insert Example - In this tutorial, we will discuss the JDBC Batch Insert example in the PostgreSQL database. Sometimes, we need to run bulk queries of a similar kind for a database, such as loading data from CSV files to relational database tables.
- Java - JDBC PostgreSQL Batch Update Example - In this tutorial, we will discuss examples of JDBC Batch update in the PostgreSQL database.
- Java - JDBC PostgreSQL Insert Image Example - In this tutorial, we will discuss how to insert an image into a PostgreSQL database with an example.
- Java - JDBC PostgreSQL Read Image Example - In the previous example, we have inserted an image into the database table. Now we are going to read the image back from the table.
Comments
Post a Comment
Leave Comment