Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)
edited by
I was attempting to build a Java application using Maven while using the Hibernate with a PostgreSQL database for persistence. What I do not understand is how to connect the PostgreSQL drivers to my application.

I get that you add dependencies in Maven's pom.xml file, which finds jars from a remote repository, though what about other jars?

1 Answer

0 votes
by (12.7k points)
edited by

PostgreSQL drivers jars are included in the Central Repository of Maven:

You can see the list of included versions of PostgreSQL drivers from here.

For PostgreSQL up to 9.1, use the following:

<dependency>
    <groupId>postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>VERSION</version>
</dependency>

For versions, 9.2+ use the following:

<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>VERSION</version>
</dependency>

Become a SQL expert with this complete SQL Training Course!

Related questions

Browse Categories

...