Subject Re: [Firebird-Java] Setting multiple TransactionParameterBuffer constants on a pooled FBSimpleDataSource
Author Mark Rotteveel
On 26-2-2018 23:48, blyons3@... [Firebird-Java] wrote:
> I can see that FBSimpleDataSource supports set/get of TPB Parameters via
> setTpbMapping() and setTransactionParameters().  How do I set the
> following parameters on an FBSimpleDataSource connection?
> I need to set the following:
> isc_tpb_nowait, isc_tpb_read_committed, isc_tpb_no_rec_version
> I've already figured out that these are int constants found in the
> TransactionParameterBufferImpl class but I can't figure out how to set
> them into connection properties at runtime.
> It looks like I can setup a Properties bundle or define one on the fly.
> But how do I specify a collection of parameters?
> It looks like I'd want:TransactionParameterBufferImpl.NOWAIT,
> TransactionParameterBufferImpl.READ_COMMITTED and
> TransactionParameterBufferImpl.NO_REC_VERSION.
> I'm using HikariCP for my Connection Pool.

Define your own TPB mapping properties file (which can either contain
all isolation levels, or just the one you want to override), for example:


Specify the bundle name on property tpbMapping, eg if you create a
resource /com/example/fb/, then you need to
specify value com.example.fb.transaction (warning: the description in
the javadoc is incorrect).

eg <prefix>.dataSource.tpbMapping=com.example.fb.transaction

Using a data source it is not possible to define the mapping of a
isolation-level itself through a property. This feature is currently
only available through the DriverManager JDBC url.

Mark Rotteveel