Martin Stiel wrote:
> 
> Hi Eric,
> 
> thank you for your comments, but I have some other questions:
> 
> > Context ctx = new InitialContext();
> > DataSource ds = (DataSource)ctx.lookup("jdbc/MyDS"); // or java:comp/env/jdbc/MyDS
> > // not really sure on this server
> > Connection conn = ds.getConnection();
> > ....
> > conn.close();
> 
>         Where and how is the string "jdbc/MyDS" (in the DS lookup) defined. Do I 
>have to
> declare it at the XML-Descriptor in the part of the CMP-Entity? If yes, what's the 
>name
> of the tag for this field?
> 
> Thanks in advance,
> 
> Martin.
> 

To get a DataSource in your CMP  EntityBean  you can do:

try {
        initialContext = new InitialContext();
        dataSource
=(DataSource)initialContext.lookup("java:comp/env/jdbc/MyDs");
            } catch (Exception e) {
     ...
     ...

With in your XML DD
 <resource-ref>
        <res-ref-name>jdbc/MyDs</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
 </resource-ref>

Best regards,

-- 
        Philippe

Philippe Coq  Groupe Bulll/BullSoft/OpenMaster  Phone: (33) 04 76 29 78
49
Bull S.A  - 1 rue de Provence - 38432 Echirolles Cedex France
[EMAIL PROTECTED]  http://www-frec.bull.com
Download our EJBServer at http://www.bullsoft.com/ejb
----
This list is cross-posted to two mail lists.  To unsubscribe,
follow the instructions below for the list you subscribed to.
For objectweb.org: send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe ejb-container-group".
For enhydra.org: send email to [EMAIL PROTECTED] and include
in the body of the message "unsubscribe ejb-container-group".

Reply via email to