Subject | Re: [Firebird-Java] Thread safe datasource as a Tomcat global resource |
---|---|
Author | Roman Rokytskyy |
Post date | 2007-06-15T09:50:19Z |
Hi,
FBConnectionPoolDataSource in a multiuser AS3AP benchmark (it opens
depending on the configuration up to 50 threads) and each test case
obtains the connection for its run. So, in fact there are many
"collisions" on the method invocation, but everything works as expected.
I cannot tell you anything about DBCP though, but I would expect it to
work as well.
proxies for connection wrappers. That means that you can't cast a
connection obtained from DBCP to FirebirdConnection interface and you
won't get access to Firebird-specific features (same applies to other
Firebird-specific JDBC extensions). So check whether you need it or not.
Roman
> In case I define a global resource in Tomcat 6 to access the sameThe Jaybird's code should be thread-safe. I use
> Firebird database through JNDI, I have two main options:
>
> - Use FBDriver through DBCP
> - Use Jaybird's built-in pooling classes like FBWrapingDatasource.
>
> Anyway, I will get the same datasource object in every web application
> under my Tomcat instance.
>
> My question is: are both options thread safe?
>
> I mean, is Datasource.getConnection() call thread safe in both cases?
FBConnectionPoolDataSource in a multiuser AS3AP benchmark (it opens
depending on the configuration up to 50 threads) and each test case
obtains the connection for its run. So, in fact there are many
"collisions" on the method invocation, but everything works as expected.
I cannot tell you anything about DBCP though, but I would expect it to
work as well.
> If both options are right, what's the best choice from a general pointI did not check the DBCP recently, but before it did not use dynamic
> of view?
proxies for connection wrappers. That means that you can't cast a
connection obtained from DBCP to FirebirdConnection interface and you
won't get access to Firebird-specific features (same applies to other
Firebird-specific JDBC extensions). So check whether you need it or not.
Roman