Hi!
Bill Pfeiffer wrote:
>
> Can I add the DataSource resource through the ejx gui or do I have to look
> up the spec and edit the ejb-jar.xml directly?
Use the GUI. That's what I do :-)
> If I have to edit it
> directly, what exactly is the XML? I didn't see a place to add a resource
> manager through the gui fo the ejb-jar.xml.
Resource managers go into jboss.xml.
> I think I set up the jboss.xml correct:
> 1. Added a JDBC Resource under the resource manager tab.
> 2. Resource name: 'Oracle'
> 3. JNDI-name of datasource: 'java:comp/env/Oracle'
No, 3 should be the global JNDI name ('Oracle' in your case).
Then you let each beans JDBC DataSource resources point to your resource
manager 'Oracle' (it might be confusing to use the same name all the
time).
> This is kind of confusing. Can you point me to some docs that explicately
> state how to name the connection in the jboss.conf, what the entrys in the
> ejb-jar.xml, and jboss.xml are supposed to be for the given connection.
No docs so far other than what I just described. As with all other docs,
this situation is being worked upon.
To summarize:
1. Add DataSource in jboss.conf pointing to physical database. Set name
to 'Oracle'.
2. Add Resource to your EJB in ejb-jar.xml of type DataSource. Set name
to 'jdbc/Oracle'. This will allow you to lookup by using
'java:comp/env/jdbc/Oracle'.
3. In jboss.xml you then add a resource manager of type JDBC, and give
it the name 'OracleDB' pointing to JNDI name 'Oracle'.
4. In jboss.xml you edit your Resource from 3 to point to the resource
manager 'OracleDB'.
You now have the following chain:
'java:comp/env/jdbc/Oracle'->'OracleDB'->'Oracle'
You might want to use generic names for Resource name and Resource
Manager. This will make it easier for you to change DB in the future.
For example:
'java:comp/env/jdbc/DB'->'AppDB'->'Oracle'
If you want to change to another database you can simply add a new
DataSource to jboss.conf and edit the resource manager link:
'java:comp/env/jdbc/DB'->'AppDB'->'InstantDB'
See, now your EJB's instantly use another DB. By doing this you can
hard-code the java: names in your EJB's and still be able to easily
change database without editing your beans. Which is the whole idea of
the "java:" namespace: to act as a level of indirection to make your
beans more portable.
I hope this made some sense. More examples are coming to make it easier
for ya all.
/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]