Skip to content

martint/jdbi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

351 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jDBI provides a convenience interface for SQL operations in Java. It is not 
intended as an abstraction layer, but rather a library which makes the common 
things easy and the hard things possible, to paraphrase Larry Wall.

The primary entry point for using jDBI is the DBI class. This is used to create
Handle instances, each of which represents a connection to the RDBMS. A Handle 
wraps a JDBC Connection instance, and makes use of that same Connection for all 
of its operations.

Generally, you will explicitely create statements, queries, and batch 
operations for working with data in the database. Seperate objects are used to
represent these things, and they are designed to be used in a somewhat 
literate-programming style. Here is an example:

  DBI dbi = new DBI("jdbc:derby:testing");
  Handle handle = dbi.open();
  Query<Something> query = handle.createQuery("select * from something where name like :name")
                                 .bind("name", "Eri%")
                                 .map(Something.class);
  List<Something> rs = query.list();
  handle.close();


INSTALLATION

Building requires Apache Ant ( http://ant.apache.org/ )

If ant complains that it cannot find the JUnit task, copy
the junit-3.8.1.jar into the $ANT_HOME/lib directory, or into
$HOME/.ant/lib and try again.

To build the runtime library, use "ant jar"

    This will produce a jdbi-<version>.jar in the build/ directory

    There are no library dependencies for jDBI

To run the unit/regression test suite use "ant test"

    Test report will be in the report/ directory

    The test suite requires the libraries in the lib/test/ directory
    and uses the Apache Derby ( http://www.apache.org/ ) embedded
    database for its tests.

About

jDBI is designed to provide convenient tabular data access in Java(tm). It uses the Java collections framework for query results, provides a convenient means of externalizing sql statements, and provides named parameter support for any database being used.

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Packages

 
 
 

Contributors

Languages

  • Java 100.0%