Bogdan
Bogdan

Reputation: 5406

Is there any lightweight JDBC wrapper with these features?

I'm thinking of trying to build my own, but I thought I'd ask here, maybe it's already been done.

Obviously I don't want to use neither an ORM nor JdbcTemplate.

Upvotes: 5

Views: 4214

Answers (3)

Tomasz Nurkiewicz
Tomasz Nurkiewicz

Reputation: 341003

What about MyBatis?

a busy cat
(source: mybatis.org)

Upvotes: 3

yegor256
yegor256

Reputation: 105210

Try JdbcSession from jcabi-jdbc. It's simple (as you want) and requires you to create a java.sql.DataSource before, for example (using BoneCP and H2 database):

BoneCPDataSource source = new BoneCPDataSource();
source.setDriverClass("org.h2.Driver");
source.setJdbcUrl("jdbc:h2:mem:x");
String name = new JdbcSession(source)
  .sql("SELECT name FROM user WHERE id = ?")
  .set(555)
  .select(new SingleHandler<String>(String.class));

Upvotes: 0

Kachwahed
Kachwahed

Reputation: 552

I'am looking for the same thing, meanwhile try out DBUtils Utility: http://commons.apache.org/dbutils/ Lightweight, open source and no dependencies.

Upvotes: 1

Related Questions