Fork me on GitHub jcabi

08-Oct-2013 0.10

Fluent wrapper around JDBC

JdbcSession is a convenient fluent wrapper around JDBC:

import com.jcabi.jdbc.JdbcSession;
public class Main {
  public static void main(String[] args) {
    String name = new JdbcSession(/* JDBC data source */)
      .sql("SELECT name FROM foo WHERE id = ?")
      .set(123)
      .select(new SingleHandler<String>(String.class));
  }
}

The only dependency you need is (you can also download jcabi-jdbc-0.10.jar and add it to the classpath):

<dependency>
  <groupId>com.jcabi</groupId>
  <artifactId>jcabi-jdbc</artifactId>
  <version>0.10</version>
</dependency>

Similar solutions (if you know others please submit it to github): ollin, JDBI, Spring JdbcTemplate.

Cutting Edge Version

If you want to use current version of the product, you can do it with this configuration in your pom.xml:

<repositories>
  <repository>
    <id>oss.sonatype.org</id>
    <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
  </repository>
</repositories>
<dependencies>
  <dependency>
    <groupId>com.jcabi</groupId>
    <artifactId>jcabi-jdbc</artifactId>
    <version>1.0-SNAPSHOT</version>
  </dependency>
</dependencies>

Copyright © 2012-2013 jcabi.com, All Rights Reserved. Privacy Policy.

site is built by Apache Maven