java.jdbc

Add function to group multiple (nested) statements / method calls on one connection without commit / rollback mechanics

Details

  • Type: Enhancement Enhancement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Currently, it is very easy to get spurious connection use on multiple statements,for instance by mapping a query function over a collection.
A workaround for this can be done by providing a binding through db-transaction.
However, this complects single connection use with commit / rollback mechanics that might be unwanted.

Another option is providing the binding yourself by wrapping it in a with-open/let construction.
This needs people to get into the implementation of the connection system, and might not play well with it.

Using connection pools is the last option, but usually is overkill for simple tasks.

Creating a macro and function that provides a simple binding for a connection in the way db-transaction does, without the included commit/rollback mechanics would do the trick. Such a function would play nice with the rest of the new connection propagation system (even including levels), and still doesn't rely on the rebinding of global vars.

Activity

Hide
Sean Corfield added a comment -
Show
Sean Corfield added a comment - FYI: https://github.com/clojuredocs/guides/blob/master/articles/ecosystem/java_jdbc/home.md#reusing-connections I'll probably add with-db-connection for this.
Hide
Sean Corfield added a comment -

Added with-db-connection. Will be in RC1.

Show
Sean Corfield added a comment - Added with-db-connection. Will be in RC1.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: