"Roger L. Cauvin" wrote:
> 
> Using jBoss 2.0 BETA PROD 02, I am trying to perform relational queries on
> the default database (the one used by default if I create an entity bean)
> from a session bean.  When I try to look up the data source in the naming
> context, I get an exception, and the jBoss console indicates that the
> database name is not bound to the naming context.
> 
> The deployment descriptor for my session bean contains the following
> element:
> 
>       <resource-ref>
>          <description>Data source for Hypersonic database.</description>
>          <res-ref-name>jdbc/Hypersonic</res-ref-name>
>          <res-type>javax.sql.DataSource</res-type>
>          <res-auth>Container</res-auth>
>       </resource-ref>
> 
> In my session bean, I have:
> 
>       DataSource dataSource = (DataSource)
> jndiContext.lookup("java:comp/env/jdbc/Hypersonic");
> 
> As I understand it, I need to add some information some configuration files
> as well, but I don't know specifically what I should add, and to which
> files.  Could someone provide this information, tailored to my particular
> example?

You re on the right way Roger...

Now you have to tell jBoss that he shall bind Hypersonic (pr whatever to
your sessions environment under the specified name. You do this in
jboss.xml.
My version of EJX doesnt support that dont know if wether I missed
something  or it isnt implemented yet... 
Anyway

You must create a resource-manager (this works with EJX):

   <resource-managers>
     ...
     <resource-manager>
        <res-name>your_resource</res-name>
        <res-jndi-name>Hypersonic</res-jndi-name>
     </resource-manager>
   </resource-managers>

the <res-name> is the logical name you give your resource
the <res-jndi-name> is the jndi name of your real DataSource you want to
use (eg: Hypersonic)

in the enterprise-beans section you have to specify the resource-ref
then:

  <enterprise-beans>
    <session>
        ...
      <resource-ref>
         <res-ref-name>jdbc/database</res-ref-name>
         <resource-name>your_resource</resource-name>
      </resource-ref>
    </session>
    ...
  </enterprise-beans>

<res-ref-name> is the same <res-ref-name> as in the <resource-ref>
section in your ejb-jar.xml file. 
<resource-name> is the logical name you gave the resource manager in the
resource-manager section.

HTH

\Daniel


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

Reply via email to