[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tomcat-user
Subject:    Re: jndi (jdbc) access out of container
From:       snpe <snpe () snpe ! co ! yu>
Date:       2004-05-06 22:32:58
Message-ID: 200405070038.38166.snpe () snpe ! co ! yu
[Download RAW message or body]

yes, I now this - but it is two datasource (two configuration)
Thanks
On Thursday 06 May 2004 11:08 am, Matt Raible wrote:
> This is probably a better question for the Spring mailing list.  But  
> since it's really pretty easy - here's how I do it.  All you really  
> need to do is define a dataSource for your tests, and one for your WAR.  
>   I basically do this in a file named applicationContext-database.xml  
> and use the one below for my tests:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
>      "http://www.springframework.org/dtd/spring-beans.dtd">
> 
> <beans>
> 
>      <bean id="propertyConfigurer"
>           
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfi 
> gurer">
>          <property  
> name="location"><value>database.properties</value></property>
>      </bean>
> 
>      <bean id="dataSource"  
> class="org.springframework.jdbc.datasource.DriverManagerDataSource">
>          <property name="driverClassName">
>              <value>${hibernate.connection.driver_class}</value>
>          </property>
>          <property name="url">
>              <value>${hibernate.connection.url}</value>
>          </property>
>          <property name="username">
>              <value>${hibernate.connection.username}</value>
>          </property>
>          <property name="password">
>              <value>${hibernate.connection.password}</value>
>          </property>
>      </bean>
> </beans>
> 
> 
> Then for running in Tomcat, I use Ant to bundle the following one in my  
> WAR:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
>      "http://www.springframework.org/dtd/spring-beans.dtd">
> 
> <beans>
>      <!-- JNDI DataSource for J2EE environments -->
>      <bean id="dataSource"  
> class="org.springframework.jndi.JndiObjectFactoryBean">
>          <property  
> name="jndiName"><value>java:comp/env/jdbc/appfuse</value></property>
>      </bean>
> </beans>
> 
> 
> HTH,
> 
> Matt
> 
> 
> On May 6, 2004, at 2:54 AM, snpe wrote:
> 
> > On Wednesday 05 May 2004 10:50 pm, QM wrote:
> >> On Thu, May 06, 2004 at 12:44:57AM +0000, snpe wrote:
> >> :   Can I access jndi out of container (from simple test application)  
> >> ?
> >>
> >> In other words, you would like to access Tomcat's JNDI provider
> >> outside of a Tomcat-managed webapp?
> >>
> >> Not possible.
> >> This has been discussed on the list before.
> >>
> >> What is your end-goal here?  There may be another way.
> >
> > I set jndi and jdbc and it wokr fine in web application (container),
> > I want now test database with same configuration  
> > (oracle,hibernate,spring and tomcat 5.0.19)
> > - I set spring context with direct jdbc datasource and create context  
> > in base TestCase (for now), but I
> > think that ispossible use same configuration - I check cactus, yet
> >
> > Thanks
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic