Reputation: 5406
<sql-query>
. See Named SQL queries for an exampleI'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
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
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