A
Alex Molochnikov
Our application lets the client see the list of schemas from the given
connection, and lets the user form SQL queries that may involve multiple
schemas.
If this application were re-engineered as an stateful session bean, how
would it handle the connections? I can see two scenarios:
1. Provide a number of schema-specific DB connection descriptors, one for
each schema, and use the connection appropriate for the query.
2. Provide one communal connection descriptor (without the schema), and set
the connection to the required schema when needed, through the Connection's
setCatalog(<schema>) method.
I can see the downside in each of these two approaches (A):
A1. Too inflexible - what if a schema is added/removed from the DB? The
descriptors will have to be changed manually, and the bean redeployed.
A2. Possible conflict with other beans - what if some other bean tries to
use the same connection object with a different setCatalog() argument,
targeting the wrong schema, while the first bean is still working its way
through querying the DB?
It is entirely possible that I am missing some important functionality in
EJB that addresses this issue, since I am still learning the EJB technology.
Your input will be greatly appreciated.
Alex Molochnikov
Gestalt Corporation
connection, and lets the user form SQL queries that may involve multiple
schemas.
If this application were re-engineered as an stateful session bean, how
would it handle the connections? I can see two scenarios:
1. Provide a number of schema-specific DB connection descriptors, one for
each schema, and use the connection appropriate for the query.
2. Provide one communal connection descriptor (without the schema), and set
the connection to the required schema when needed, through the Connection's
setCatalog(<schema>) method.
I can see the downside in each of these two approaches (A):
A1. Too inflexible - what if a schema is added/removed from the DB? The
descriptors will have to be changed manually, and the bean redeployed.
A2. Possible conflict with other beans - what if some other bean tries to
use the same connection object with a different setCatalog() argument,
targeting the wrong schema, while the first bean is still working its way
through querying the DB?
It is entirely possible that I am missing some important functionality in
EJB that addresses this issue, since I am still learning the EJB technology.
Your input will be greatly appreciated.
Alex Molochnikov
Gestalt Corporation