tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pfingstl Gernot" <>
Subject JNDI DataSources
Date Sun, 18 Jan 2004 21:32:37 GMT
I want to use one JDBC connection pool in my tomcat (4.1) instance for all contexts; therefore
I configure the DataSource in <GlobalNamingResources>. In each context I put a <ResourceLink>
so I can obtain the DataSource in my applications.
But now I have the problem that I had to execute some SQL statements (e.g. a "set role" statement
or some calls to stored procedures...) on the connection before it will passed to the application.
This statements are different from context to context.
My current solution is: I wrote a resource factory class, which is configured in every context.
It does a JDNI lookup to the global connection pool, gets the DataSource and put it in a wrapper
class, which exectures the SQL statetments before getConnection() deliveres the connection
to the application. The SQL statements a read in before as resource parameters. This works
fine except that global connection pool must be declared in the context with <ResourceLink>.
So the application can also use this DataSource. I want to prohibit that the application can
use the original DataSource!
Is there a way to use a global resource only in a (context local) resource factory class and
prohibit the application to use this global resource? Or do you have a better solution to
solve this problem?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message