Hi!
There seem to be so many postings about this stuff and all the solutions
seem to involve the use of jboss.xml. The documentation says "Note that
this file [jboss.xml] is almost NEVER required by JBoss."
I would really like to be able to access the DataSource as all the books
and tutorials describe (without the use of a vendor specific conf
file)...as below:
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/TWANG_DS");
I've got this to work but only with an extra level of indirection by
using jboss.xml. There must be a way to avoid this and still be able to
access the datasource using the format
"java:comp/env/jdbc/DATASOURCE_NAME".
I would really appreciate any advice/suggestions/solutions.
Cheers
oliver
Here are the relevant bits in the config/code files:
DAO.java
--------
...
try
{
InitialContext ic = new InitialContext();
dbDataSource = (DataSource) ic.lookup("java:comp/env/jdbc/TWANG_DS");
}
catch (NamingException ne)
{
//error
}
...
ejb-jar.xml
-----------
...
<resource-ref>
<description>DataSource for the STRUM database</description>
<res-ref-name>jdbc/TWANG_DS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
...
jboss.xml
---------
...
<resource-managers>
<resource-manager>
<res-name>jdbc/TWANG_DS</res-name> <!-- DB name used in your EJB
-->
<res-jndi-name>java:/STRUM</res-jndi-name>
</resource-manager>
</resource-managers>
...
jboss.jcml
----------
...
<mbean code="org.jboss.jdbc.JdbcProvider"
name="DefaultDomain:service=JdbcProvider">
<attribute
name="Drivers">COM.cloudscape.core.RmiJdbcDriver,sun.jdbc.odbc.JdbcOdbcD
river</attribute>
</mbean>
<mbean code="org.jboss.jdbc.XADataSourceLoader"
name="DefaultDomain:service=XADataSource,name=STRUM">
<attribute
name="DataSourceClass">org.opentools.minerva.jdbc.xa.wrapper.XADataSourc
eImpl</attribute>
<attribute name="PoolName">STRUM</attribute>
<attribute
name="URL">jdbc:cloudscape:rmi://localhost:1088/STRUM</attribute>
<attribute name="JDBCUser"></attribute>
<attribute name="Password"></attribute>
</mbean>
...
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user