Subject Re: [Firebird-Java] Setting multiple TransactionParameterBuffer constants on a pooled FBSimpleDataSource
Author Mark Rotteveel
On 2018-03-02 19:53, blyons3@... [Firebird-Java] wrote:
> Re:
> 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.
>
> ...Well, that's a real problem. The initial setup required changing
> to use database and dataSourceClassName for loading at Runtime. I do
> realize that this is a lack of understanding on my part for how to use
> the HikariCP with a JDBC URL and Firebird. I can see that the
> beautiful createHikariFactoryDataSource() method that you provided
> uses the class loader to load the DataSource Class
> (org.firebirdsql.ds.FBSimpleDataSource) and then calling the
> constructor to get the DataSource:

Why is that a problem? I also described a method that works: provide a
properties-file on the classpath with the config you want, and reference
that in property tpbMapping.

Alternatively, if you really want to be able to directly specify the
mapping itself, you should switch to using HikariCP with a driver class
instead of a datasource (see also the suggestion by brettw - the creator
of HikariCP - on Stack Overflow).

> DataSource dataSource = (DataSource)
> dataSourceClass.getConstructor().newInstance();
>
> What are the correct classes and implementation to use when loading
> for jdbcUrl? I only see a jdbcUrl property on the GDSFactory class.

The jdbcUrl property is a property of HikariCP itself, to use that:

- Remove the hikari.dataSourceClassName from the config (or if you
created an explicit instance of data source: remove that.
- specify the hikari.jdbcUrl property with the full JDBC url
- (optionally) specify propery
hikari.driverClassName=org.firebirdsql.jdbc.FBDriver
- (optionally) remove the hikari.dataSource properties (alternatively,
if you do specify them, they are handled the same as properties
specified in the JDBC url

> Bottom line:
>
> I'm not sure how to modify the DataSource to use the correct class
> loader and then connect to the database using a jdbcUrl like:
> jdbc:firebirdsql:server:/path/database.GDB

If you really want to specify a JDBC URL, then just don't use
FBSimpleDataSource, but just use the hikari.jdbcUrl property, which will
use the driver instead.

Mark