Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find the PostGresql 9.2 JDBC 4 drivers in a maven repo?

Looking at the maven central repository the newest jdbc4 driver available for PostGresql is only the 9.1 driver

http://mvnrepository.com/artifact/postgresql/postgresql/9.1-901.jdbc4

There is a newer file called "postgresql-9.2-1002.jdbc4.jar" available on http://jdbc.postgresql.org/download.html but it has not been released to Maven central.

like image 518
benstpierre Avatar asked Dec 12 '12 15:12

benstpierre


People also ask

Where is JDBC driver in PostgreSQL?

The PostgreSQL JDBC driver is available in the Maven central repository.

Does Postgres have JDBC driver?

PostgreSQL provides a type 4 JDBC driver. Type 4 indicates that the driver is written in Pure Java, and communicates in the database system's own network protocol. Because of this, the driver is platform independent; once compiled, the driver can be used on any system.


3 Answers

It seems like PostgreSQL has updated their groupId to org.postgresql instead of postgresql.

So now it is possible to use maven directly (mvnrepository.com):

<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>9.2-1002-jdbc4</version>
</dependency>
like image 51
maba Avatar answered Oct 19 '22 19:10

maba


Following dependency description works for me:

<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>9.2-1002-jdbc4</version>
</dependency>
like image 29
user2083084 Avatar answered Oct 19 '22 17:10

user2083084


(This answer is now outdated; the jars have been released to maven under the groupid org.postgresql. See more recent answers for details.)

You can simply install the driver to your local ~/.m2 repository. See the maven documentation and this question.

mvn install:install-file \
  -DgroupId=postgresql \
  -DartifactId=postgresql \
  -Dpackaging=jar \
  -Dversion=9.2-1002.jdbc4 \
  -Dfile=postgresql-9.2-1002.jdbc4.jar \
  -DgeneratePom=true

Alternately, if you're using Sonatype Nexus to manage repositories and caching - which I highly recommend - then you can add the jar to a locally maintained repository in your Nexus instance.

like image 6
Craig Ringer Avatar answered Oct 19 '22 19:10

Craig Ringer