Ben, thanks for your answer. But the DS I would like to get is the Struts DS. The one 
I defined in the struts-config.xml.
When I do the naming lookup as you described I get 
"javax.naming.NameNotFoundException: Name jdbc is not bound in this Context"
 
Philipp

        -----Ursprüngliche Nachricht----- 
        Von: Ben Anderson [mailto:[EMAIL PROTECTED] 
        Gesendet: Fr 17.10.2003 16:22 
        An: [EMAIL PROTECTED] 
        Cc: 
        Betreff: Re: Looking up the Struts Datasource
        
        

        It depends on the container as to how you put the datasource into the
        context.
        
        If you're using Tomcat 4.1:
        
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
        
        Then to access the datasource:
                String dsName = "java:comp/env/jdbc/myDS";
                ctx = new InitialContext();
                DataSource ds = (DataSource)ctx.lookup(dsName);
        
        
        
        >From: Philipp Röthl <[EMAIL PROTECTED]>
        >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
        >To: <[EMAIL PROTECTED]>
        >Subject: Looking up the Struts Datasource
        >Date: Fri, 17 Oct 2003 15:50:23 +0200
        >
        >Hi,
        >
        >I've implemented a struts application that uses JavaBeans which perform the
        >whole business logic. These beans access an Oracle DB. The datasource is
        >passed from the action classes to the bean classes as a parameter.
        >
        >Now I have to implement a WebService that does the same as the Struts
        >Application. Therefore I use the same JavaBeans.
        >
        >My problem now is: I have to pass the datasource to the Java Beans. I've
        >read that I should be able to access the Struts Datasource via JNDI. But
        >how?
        >
        >Thanks for any help.
        >
        >Philipp
        >
        >---------------------------------------------------------------------
        >To unsubscribe, e-mail: [EMAIL PROTECTED]
        >For additional commands, e-mail: [EMAIL PROTECTED]
        >
        
        _________________________________________________________________
        Cheer a special someone with a fun Halloween eCard from American Greetings!
        Go to  http://www.msn.americangreetings.com/index_msn.pd?source=msne134
        
        
        ---------------------------------------------------------------------
        To unsubscribe, e-mail: [EMAIL PROTECTED]
        For additional commands, e-mail: [EMAIL PROTECTED]
        
        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to