Forums Register Login

What is the best way for data source lookup from session bean??

+Pie Number of slices to send: Send
hi,
What is the best way for data source lookup from
session been when both (ejb contaioner and data
source) exist in same websphere 3.5 app. server.
Is it a good idea to store the data source instance in static field in a bean and access same using sataic methods. Please advise.
url or sample code pls
+Pie Number of slices to send: Send
An ejb must not use static variables.
Better perform a lookup on a managed resource for which you added a resource-ref entry in the deployment descriptor.
+Pie Number of slices to send: Send
That would be hunky-dory IF he was working in an EJB 1.1 or EJB 2.0 compliant container -- but WAS 3.5 is only EJB 1.0 compliant. (He's two versions back from the current version).
Actually, storing a DataSource in a singleton (so long as it's a special singleton helper class and you DON'T try to put a static variable in the EJB like Michael said) would work fine.
Kyle
Something about .... going for a swim. With this tiny ad ...
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 556 times.
Similar Threads
Streaming Music from a servlet
Rendering of Servlet output
ejb using datasource best practice
Back to front Entity bean generation in WebSphere 5.1
Calling Entity Bean from SessionBean
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 03:28:25.