Hi!

Justin Forder wrote:
> Hey, you're telling me about the connection for my CMP beans! I know
> that part!
> 
> I'm asking how to connect to the same DB from a stateless session bean.

I could tell you the easy way to do it, but.. I won't :-)

Here's the proper way to do it:
in your EJB 1.1 deployment descriptor you should add a resource
reference to a DataSource. In your jBoss descriptor you should link it
to a resource manager. Then add a JDBC resource manager that points to a
DataSource ("InstantDB" and "Hypersonic" are the default JNDI-names).
Your beans can then do new
InitialContext().lookup("java:comp/env/jdbc/mydb") and get a DataSource
object to get DB connections from. Now your beans will be portable 'n
all (if you want to change DB you simply changed the resource manager
mapping, no change to beans).

/Rickard

-- 
Rickard �berg

@home: +46 13 177937
Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to