Possible bug with Tranql DataSourceMCF

View: New views
3 Messages — Rating Filter:   Alert me  

Possible bug with Tranql DataSourceMCF

by adepue :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've been testing the Tranql DataSourceMCF in my Spring app and have run
into a problem.  I'd like to see if this is an actual bug before I open
a new JIRA issue.  It seems Tranql is not using the database connection
URL to distinguish underlying connections in its connection pool, which
causes DataSourceMCF to sometimes return a connection to the wrong DB!  
I have two DataSourceMCFs defined in my Spring app that connect to two
different databases.  They both use the same DB driver and the same
username/password.  The only difference is in the URL.  See below for my
Spring xml.  Anyway, the 'audit.ds' is almost always returning a
connection to the 'main.ds' database - unless all connections to the
'main.ds' in the connection pool are exhausted.  Is this expected?  
Should I be using a different ConnectionManager with each
DataSourceMCF?  Or is this a bug?
Note, I'm using Jencks 2, and I've modified the Spring config below to
show our test HSQLDB config.

Thanks,
  Andy

Here is my Spring config:

<beans>
  ...
  <bean id="transactionManager"
class="org.jencks.factory.TransactionManagerFactoryBean"/>
 
  <bean id="connectionManager"
class="org.jencks.factory.ConnectionManagerFactoryBean">
    <property name="transactionManager" ref="transactionManager"/>
    <property name="poolMaxSize" value="20"/>
  </bean>

  <bean id="main.ds"
class="org.jencks.factory.ConnectionFactoryFactoryBean">
    <property name="managedConnectionFactory">
      <bean class="org.jencks.tranql.DataSourceMCF">
        <property name="driverName" value="org.hsqldb.jdbcDriver"/>
        <property name="user" value="sa"/>
        <property name="password" value=""/>
        <property name="url" value="jdbc:hsqldb:file:testmain"/>
      </bean>
    </property>
  </bean>

  <bean id="audit.ds"
class="org.jencks.factory.ConnectionFactoryFactoryBean">
    <property name="managedConnectionFactory">
      <bean class="org.jencks.tranql.DataSourceMCF">
        <property name="driverName" value="org.hsqldb.jdbcDriver"/>
        <property name="user" value="sa"/>
        <property name="password" value=""/>
        <property name="url" value="jdbc:hsqldb:file:testaudit"/>
      </bean>
    </property>
  </bean>
  ...
</beans>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Possible bug with Tranql DataSourceMCF

by adepue :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

BTW, it works fine if I use a separate ConnectionManager with each
datasource.  However, it doesn't seem right that I have to use two
ConnectionManagers?

  - Andy

Andy DePue wrote:

> I've been testing the Tranql DataSourceMCF in my Spring app and have
> run into a problem.  I'd like to see if this is an actual bug before I
> open a new JIRA issue.  It seems Tranql is not using the database
> connection URL to distinguish underlying connections in its connection
> pool, which causes DataSourceMCF to sometimes return a connection to
> the wrong DB!  I have two DataSourceMCFs defined in my Spring app that
> connect to two different databases.  They both use the same DB driver
> and the same username/password.  The only difference is in the URL.  
> See below for my Spring xml.  Anyway, the 'audit.ds' is almost always
> returning a connection to the 'main.ds' database - unless all
> connections to the 'main.ds' in the connection pool are exhausted.  Is
> this expected?  Should I be using a different ConnectionManager with
> each DataSourceMCF?  Or is this a bug?
> Note, I'm using Jencks 2, and I've modified the Spring config below to
> show our test HSQLDB config.
>
> Thanks,
>  Andy
>
> Here is my Spring config:
>
> <beans>
>  ...
>  <bean id="transactionManager"
> class="org.jencks.factory.TransactionManagerFactoryBean"/>
>
>  <bean id="connectionManager"
> class="org.jencks.factory.ConnectionManagerFactoryBean">
>    <property name="transactionManager" ref="transactionManager"/>
>    <property name="poolMaxSize" value="20"/>
>  </bean>
>
>  <bean id="main.ds"
> class="org.jencks.factory.ConnectionFactoryFactoryBean">
>    <property name="managedConnectionFactory">
>      <bean class="org.jencks.tranql.DataSourceMCF">
>        <property name="driverName" value="org.hsqldb.jdbcDriver"/>
>        <property name="user" value="sa"/>
>        <property name="password" value=""/>
>        <property name="url" value="jdbc:hsqldb:file:testmain"/>
>      </bean>
>    </property>
>  </bean>
>
>  <bean id="audit.ds"
> class="org.jencks.factory.ConnectionFactoryFactoryBean">
>    <property name="managedConnectionFactory">
>      <bean class="org.jencks.tranql.DataSourceMCF">
>        <property name="driverName" value="org.hsqldb.jdbcDriver"/>
>        <property name="user" value="sa"/>
>        <property name="password" value=""/>
>        <property name="url" value="jdbc:hsqldb:file:testaudit"/>
>      </bean>
>    </property>
>  </bean>
>  ...
> </beans>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Possible bug with Tranql DataSourceMCF

by rabueckers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a very similar problem, were you ever able to figure this out?

adepue wrote:
BTW, it works fine if I use a separate ConnectionManager with each
datasource.  However, it doesn't seem right that I have to use two
ConnectionManagers?

  - Andy

Andy DePue wrote:
> I've been testing the Tranql DataSourceMCF in my Spring app and have
> run into a problem.  I'd like to see if this is an actual bug before I
> open a new JIRA issue.  It seems Tranql is not using the database
> connection URL to distinguish underlying connections in its connection
> pool, which causes DataSourceMCF to sometimes return a connection to
> the wrong DB!  I have two DataSourceMCFs defined in my Spring app that
> connect to two different databases.  They both use the same DB driver
> and the same username/password.  The only difference is in the URL.  
> See below for my Spring xml.  Anyway, the 'audit.ds' is almost always
> returning a connection to the 'main.ds' database - unless all
> connections to the 'main.ds' in the connection pool are exhausted.  Is
> this expected?  Should I be using a different ConnectionManager with
> each DataSourceMCF?  Or is this a bug?
> Note, I'm using Jencks 2, and I've modified the Spring config below to
> show our test HSQLDB config.
>
> Thanks,
>  Andy
>
> Here is my Spring config:
>
> <beans>
>  ...
>  <bean id="transactionManager"
> class="org.jencks.factory.TransactionManagerFactoryBean"/>
>
>  <bean id="connectionManager"
> class="org.jencks.factory.ConnectionManagerFactoryBean">
>    <property name="transactionManager" ref="transactionManager"/>
>    <property name="poolMaxSize" value="20"/>
>  </bean>
>
>  <bean id="main.ds"
> class="org.jencks.factory.ConnectionFactoryFactoryBean">
>    <property name="managedConnectionFactory">
>      <bean class="org.jencks.tranql.DataSourceMCF">
>        <property name="driverName" value="org.hsqldb.jdbcDriver"/>
>        <property name="user" value="sa"/>
>        <property name="password" value=""/>
>        <property name="url" value="jdbc:hsqldb:file:testmain"/>
>      </bean>
>    </property>
>  </bean>
>
>  <bean id="audit.ds"
> class="org.jencks.factory.ConnectionFactoryFactoryBean">
>    <property name="managedConnectionFactory">
>      <bean class="org.jencks.tranql.DataSourceMCF">
>        <property name="driverName" value="org.hsqldb.jdbcDriver"/>
>        <property name="user" value="sa"/>
>        <property name="password" value=""/>
>        <property name="url" value="jdbc:hsqldb:file:testaudit"/>
>      </bean>
>    </property>
>  </bean>
>  ...
> </beans>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email