Skip to content

worldbiomusic/CupOfDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

CupOfDB

Simple JDBC wrapper for Java

Features

  • Connection pooling
  • No need to close connection, statement, and result set (AutoCloseable)
  • Support lambda for query and update

Usage

  1. create a pitcher with a name, url, username, and password
Pitcher pitcher = new Pitcher("{pitcher_name}", "{url}", "{username}", "{password}");
  1. create a spoon and set it to the pitcher
Spoon spoon = new NormalSpoon(pitcher, 10, 3, 5, 1, 1);
pitcher.setSpoon(spoon);
pitcher.stirSpoon(); // start connection pooling thread
  1. get a cup(connection) from the pitcher
Cup cup = pitcher.getCup();
  1. query the database
cup.query("SELECT name from USER where id = 1", resultSet -> {
try {
    System.out.println("Name: " + resultSet.getString("name"));
} catch (SQLException e) {
    e.printStackTrace();
}});

Terms

Class names are

  • Tray is a Pitcher pool.
  • Pitcher is a Cup pool.
  • Spoon is a Pitcher pool manager.
  • Cup is a connection.

LICENSE

MIT

TODO

  • support json option
  • support javadoc
  • register to maven central
  • release jar
  • support pitcher log writer and login timeout

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages