Wrong connection settings when more than one BoneCPConnectionProvider

Bug #1170056 reported by Bruno Medeiros
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
BoneCP
Incomplete
Undecided
Unassigned

Bug Description

I'm trying to implement a AbstractMultiTenantConnectionProvider implementation backed by BoneCP, and to accomplish that I need to create more than one BoneCPConnectionProvider in the same JVM.
For some reason, after create more than one BoneCPConnectionProvider, all connection providers always provide connections to the first BoneCPConnectionProvider created.

I double checked the configurations inside each BoneCPConnectionProvider, before the getConnection() call, and they point to the right database, but after the getConnection() call the URL of the connection poins to the URL of the first BoneCPConnectionProvider created.

I'm using 0.8.0-alpha-1. The providers are created like the following:

 public static <S extends ConnectionProvider & Stoppable> S buildConnectionProvider(String string, ServiceRegistryImplementor serviceRegistry) {

  BoneCPConnectionProvider np = new BoneCPConnectionProvider();
  //C3P0ConnectionProvider np = new C3P0ConnectionProvider();
  np.injectServices(serviceRegistry);

  Map<String, String> map = new HashMap<String, String>();
  map.put("hibernate.connection.url", "jdbc:postgresql://127.0.0.1:5434/" + string);
  map.put("hibernate.connection.username", string);
  map.put("hibernate.connection.password", string);
  map.put("hibernate.connection.driver_class", "org.postgresql.Driver");

  np.configure(map);

  return (S) np;
 }

Switching to C3P0 fixes the problem, but I would like to stick with BoneCP for several reasons ;)

This is a very dangerous bug, please let me know if you need more info.

description: updated
description: updated
Revision history for this message
Wallace Wadge (wwadge) wrote :

Does the same happen if you use datasource instead of connection provider? Can you provide me with a unit test?

Changed in bonecp:
status: New → Incomplete
Revision history for this message
Wallace Wadge (wwadge) wrote :

... and apologies for the very long reply time!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.