Is there a lightweight JDBC wrapper with these features?

  • Named parameters like JdbcTemplate from Spring
  • XML configuration for JDBC connection parameters
  • XML configuration for queries. Something like Hibernate <sql-query> . See Named SQL Queries for an example.

I’m thinking about trying to build my own, but I thought I would ask here, maybe it’s already done.

Obviously, I don't want to use either ORM or JdbcTemplate.

+4
source share
3 answers

What about MyBatis ?

a busy cat
(source: mybatis.org )

+2
source

I am looking for the same, so far I will try the DBUtils utility: http://commons.apache.org/dbutils/ Lightweight, open source and without dependencies.

+1
source

Try JdbcSession from jcabi-jdbc . It is simple (as you wish) and requires that you create java.sql.DataSource earlier, 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)); 
0
source

Source: https://habr.com/ru/post/1383391/


All Articles