Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between JDBC API and PostgreSQL Driver?

I am creating a new Spring Boot project (https://start.spring.io/), and I am not understanding the different dependencies provided for interfacing with relational databases.

The point of confusion is "JDBC API" and "PostgresSQL Driver". My app needs to connect to a PostgreSQL database. So, which of the following are true?

  1. JDBC API can be used to connect and operate with any relational (SQL) database (MySQL, PostgreSQL, etc.), and PostgresSQL Driver is not needed for JDBC API to work.

  2. Both JDBC API and PostgresSQL Driver are needed for an application to connect to a PostgreSQL database.

  3. The dependency PostgresSQL Driver includes JDBC API.

I have already googled about this, but there are only manuals of how to use them.

like image 352
Rick Avatar asked Aug 31 '20 21:08

Rick


People also ask

What is the difference between JDBC and API?

JDBC is a Java API for connecting to various types of RDBMS. API stands for "application programming interface." JDBC is definitely one of these, and so is HBase.

What is PostgreSQL JDBC driver?

PostgreSQL JDBC Driver (PgJDBC for short) allows Java programs to connect to a PostgreSQL database using standard, database independent Java code. Is an open source JDBC driver written in Pure Java (Type 4), and communicates in the PostgreSQL native network protocol.

Is JDBC driver an API?

Overview. The Microsoft JDBC Driver for SQL Server provides an API that can be used within Java programming code to connect to and interact with a MicrosoftSQL Server database.

Does JDBC work with PostgreSQL?

To connect to the PostgreSQL database server from a Java program, you need to have PostgreSQL JDBC driver. You can download the latest version of the driver on the postgresql.org website via the download page. The downloaded file is a jar file.

What is the PostgreSQL SQL driver?

The Postgres SQL Driver is an implementation of the JDBC interfaces which allows you to connect to the Postgres database When selecting your dependencies from start.spring.io, your Option 2 is correct. You need both the specification of the API (JDBC) and the implementation of the API (PostgreSQL driver) as dependencies within your project.

What is the difference between a JDBC driver and a driver?

A driver is nothing but software required to connect to a database from a Java program. JDBC is just an API, which Java has designed and the onus to implement this API lies on different vendor because different database works in a different way, they internally use different protocols.

What is PostgreSQL ODBC?

PostgreSQL is a free and Open-Source ORDBMS. Users: PostgreSQL users include Apple, Cisco, Etsy, Facebook, Instagram, Red Hat, Skype, Spotify, Yahoo to name a few. What are ODBC Drivers? ODBC Drivers leverage the Open Database Connectivity Interface offered by Microsoft.

What is the difference between JDBC and JDBS?

For reference, JDBC is a standard API that allows access to a database through SQL language in a database independant way. In that sense, JDBS is a Java API, but database authors can provide other Java API ...


Video Answer


1 Answers

JDBC defines an API to connect and work with relational databases. The PostgreSQL driver is an implementation of this API for the PostgreSQL database.

You cannot use the JDBC API without an underlying driver to implement it. You could, however, use the driver directly, but drivers usually have very little guarantees about the stability of their APIs (other than what's promised by JDBC, of course), so it would probably be a poor idea.

like image 87
Mureinik Avatar answered Oct 01 '22 16:10

Mureinik