heroku-jdbc

Helper library for parsing Database URL into JDBC connection

License

License

MIT
Categories

Categories

Heroku Container PaaS Providers
GroupId

GroupId

com.heroku.sdk
ArtifactId

ArtifactId

heroku-jdbc
Last Version

Last Version

0.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

heroku-jdbc
Helper library for parsing Database URL into JDBC connection
Project URL

Project URL

http://github.com/jkutner/heroku-jdbc
Source Code Management

Source Code Management

http://github.com/jkutner/heroku-jdbc

Download heroku-jdbc

How to add to project

<!-- https://jarcasting.com/artifacts/com.heroku.sdk/heroku-jdbc/ -->
<dependency>
    <groupId>com.heroku.sdk</groupId>
    <artifactId>heroku-jdbc</artifactId>
    <version>0.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.heroku.sdk/heroku-jdbc/
implementation 'com.heroku.sdk:heroku-jdbc:0.1.1'
// https://jarcasting.com/artifacts/com.heroku.sdk/heroku-jdbc/
implementation ("com.heroku.sdk:heroku-jdbc:0.1.1")
'com.heroku.sdk:heroku-jdbc:jar:0.1.1'
<dependency org="com.heroku.sdk" name="heroku-jdbc" rev="0.1.1">
  <artifact name="heroku-jdbc" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.heroku.sdk', module='heroku-jdbc', version='0.1.1')
)
libraryDependencies += "com.heroku.sdk" % "heroku-jdbc" % "0.1.1"
[com.heroku.sdk/heroku-jdbc "0.1.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Heroku JDBC Download

This is a helper library for parsing DATABASE_URL from the environment and turning it into a JDBC connection.

Usage

In your pom.xml:

<dependency>
  <groupId>com.heroku.sdk</groupId>
  <artifactId>heroku-jdbc</artifactId>
  <version>${heroku-jdbc.version}</version>
</dependency>

For PostgreSQL (the default):

Connection conn = DatabaseUrl.extract().getConnection();

For other Database vendors:

Connection conn = DatabaseUrl.extract().getConnection("mysql://");

For Spring or Apache DBCP:

DatabaseUrl dbUrl = DatabaseUrl.extract();

BasicDataSource basicDataSource = new BasicDataSource();
basicDataSource.setUrl(dbUrl.jdbcUrl(););
basicDataSource.setUsername(dbUrl.username());
basicDataSource.setPassword(dbUrl.password());

License

MIT

Versions

Version
0.1.1
0.1.0