struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tbac...@kcp.com
Subject Re: Multiple DataSource Problem
Date Thu, 05 Dec 2002 20:02:31 GMT

Did I not give each data-source element its own key?

Tim Bachta
Information Technology
MC 48



                                                                                         
                                             
                      "David Graham"                                                     
                                             
                      <dgraham1980@hotm        To:       struts-user@jakarta.apache.org
                                               
                      ail.com>                 cc:                                    
                                                
                                               Subject:  Re: Multiple DataSource Problem 
                                             
                      12/05/2002 01:41                                                   
                                             
                      PM                                                                 
                                             
                      Please respond to                                                  
                                             
                      "Struts Users                                                      
                                             
                      Mailing List"                                                      
                                             
                                                                                         
                                             
                                                                                         
                                             




You need to give each data-source element its own key.  Struts stores the
DataSource under that key in the ServletContext.

David






>From: tbachta@kcp.com
>Reply-To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
>To: struts-user@jakarta.apache.org
>Subject: Multiple DataSource Problem
>Date: Thu, 5 Dec 2002 13:20:01 -0600
>
>I am having trouble getting multiple datasources to work in my
application.
>I have searched the archives and found inofrmation on how to do it but the
>solutions given are depricated.  Can anyone help me?
>
>
><data-sources>
>             <data-source>
>                   <set-property property="key" value="MRA"/>
>                   <set-property property="driverClass" value
>="oracle.jdbc.driver.OracleDriver"/>
>                   <set-property property="url" value="jdbc:oracle:thin:
>@147.101.104.63:1524:common"/>
>                   <set-property property="user" value="MRA"/>
>                   <set-property property="password" value="mralog"/>
>             </data-source>
>             <data-source>
>                   <set-property property="key" value="PHONE_DB"/>
>                   <set-property property="driverClass" value
>="oracle.jdbc.driver.OracleDriver"/>
>                   <set-property property="url" value="jdbc:oracle:thin:
>@oid:1521:infoprd"/>
>                   <set-property property="user" value="info_user"/>
>                   <set-property property="password" value="info_user"/>
>             </data-source>
>       </data-sources>
>
>
>
>try
>     {
>       ServletContext context = servlet.getServletContext();
>       DataSource dataSource = (DataSource)
>context.getAttribute(Action.DATA_SOURCE_KEY);
>       conn = dataSource.getConnection();
>       stmt = conn.createStatement();
>       rs = stmt.executeQuery(sql);
>
>  Thank you for your help
>
>Tim Bachta
>Information Technology
>MC 48
>
>
>
>
>--
>To unsubscribe, e-mail:
><mailto:struts-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail:
><mailto:struts-user-help@jakarta.apache.org>


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus


--
To unsubscribe, e-mail:   <
mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:struts-user-help@jakarta.apache.org>







--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message