Thanks, i'll look at the DTD for more info... I thought that was what i was doing with <set-property property="key" value="prdDataexport" />. Almost every document i've read says i should be able to get the datasource via the key "prdDataexport", but the only way i get it is when i use the default Action.DATA_SOURCE_KEY...
Also, i'm using struts 1.0.2. -----Original Message----- From: David Graham [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 9:49 PM To: [EMAIL PROTECTED] Subject: RE: Connection Pool The set-property element calls a setter on the DataSource java bean. Use the key attribute of the data-source element to assign keys. See the struts-config.xml DTD for details. David >From: Jimmy Emmanual <[EMAIL PROTECTED]> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> >Subject: RE: Connection Pool >Date: Wed, 19 Mar 2003 21:41:32 -0500 > >This is the definition in the struts-config.xml file. > > <data-sources> > > <!-- PRODUCTION/dataexport --> > <data-source> > <set-property property="key" value="prdDataexport" /> > <set-property property="description" value="sylDataexport" >/> > <set-property property="driverClass" >value="com.sybase.jdbc2.jdbc.SybDriver" /> > <set-property property="url" >value="jdbc:sybase:Tds:PRODUCTION:4100/dataexport" /> > <set-property property="maxCount" value="10" /> > <set-property property="minCount" value="1" /> > <set-property property="user" value="PRD" /> > <set-property property="password" value="PRD" /> > </data-source> > > <!-- PRODUCTION/GPS --> > <data-source> > <set-property property="key" value="prdGps" /> > <set-property property="driverClass" >value="com.sybase.jdbc2.jdbc.SybDriver" /> > <set-property property="url" >value="jdbc:sybase:Tds:PRODUCTION:4100/GPS" /> > <set-property property="maxCount" value="10" /> > <set-property property="minCount" value="1" /> > <set-property property="user" value="PRD" /> > <set-property property="password" value="PRD" /> > </data-source> > > <!-- PRODUCTION/GPS4 --> > <data-source> > <set-property property="key" value="prdGps4" /> > <set-property property="driverClass" >value="com.sybase.jdbc2.jdbc.SybDriver" /> > <set-property property="url" >value="jdbc:sybase:Tds:PRODUCTION:4100/GPS4" /> > <set-property property="maxCount" value="10" /> > <set-property property="minCount" value="1" /> > <set-property property="user" value="PRD" /> > <set-property property="password" value="PRD" /> > </data-source> > > <!-- REPLICATION/GPS --> > <data-source> > <set-property property="key" value="repGps" /> > <set-property property="driverClass" >value="com.sybase.jdbc2.jdbc.SybDriver" /> > <set-property property="url" >value="jdbc:sybase:Tds:REPLICATION:4100/GPS" /> > <set-property property="maxCount" value="10" /> > <set-property property="minCount" value="1" /> > <set-property property="user" value="REP" /> > <set-property property="password" value="REP" /> > </data-source> > > <!-- TEST/dataexport --> > <data-source> > <set-property property="key" value="tstDataexport" /> > <set-property property="driverClass" >value="com.sybase.jdbc2.jdbc.SybDriver" /> > <set-property property="url" >value="jdbc:sybase:Tds:TEST:4100/dataexport" /> > <set-property property="maxCount" value="10" /> > <set-property property="minCount" value="1" /> > <set-property property="user" value="TST" /> > <set-property property="password" value="TST" /> > </data-source> > > <!-- TEST/GPS_QA --> > <data-source> > <set-property property="key" value="tstGps_qa" /> > <set-property property="driverClass" >value="com.sybase.jdbc2.jdbc.SybDriver" /> > <set-property property="url" >value="jdbc:sybase:Tds:TEST:4100/GPS_QA" /> > <set-property property="maxCount" value="10" /> > <set-property property="minCount" value="1" /> > <set-property property="user" value="TST" /> > <set-property property="password" value="TST" /> > </data-source> > > </data-sources> > >-----Original Message----- >From: Lee, Dennis [mailto:[EMAIL PROTECTED] >Sent: Wednesday, March 19, 2003 9:36 PM >To: 'Struts Users Mailing List' >Subject: RE: Connection Pool > > >Hi, > >I declared different datasource for different environment (Development, >UAT, >Production). >"desconfig" is an object of my "Configuration class", it has an attribute >"datasource" of the type String. > >I am using Struts 1.1b2. > >Maybe you should post your datasource setting in struts-config.xml as well. > >Best Regards, >Dennis Lee > > >-----Original Message----- >From: Jimmy Emmanual [mailto:[EMAIL PROTECTED] >Sent: Thursday, March 20, 2003 10:28 AM >To: 'Struts Users Mailing List' >Subject: RE: Connection Pool > > >Dennis, > >Thank you very much. However, what do you declare "desconfig" as? > >-----Original Message----- >From: Lee, Dennis [mailto:[EMAIL PROTECTED] >Sent: Wednesday, March 19, 2003 9:24 PM >To: 'Struts Users Mailing List' >Subject: RE: Connection Pool > > >Hi, > >Here is my code snippet: > > // initialization - Datasource and Name Service > log.info("Initializing configuration plug in : Datasource >and Name service"); > DataSource dataSource = null; > if (StringUtils.isEmpty(desconfig.getDatasource())) { > dataSource = (DataSource) >servlet.getServletContext().getAttribute(Action.DATA_SOURCE_KEY); > } else { > dataSource = (DataSource) >servlet.getServletContext().getAttribute(desconfig.getDatasource()); > >servlet.getServletContext().setAttribute(Action.DATA_SOURCE_KEY, >dataSource); > } > >Note: >desconfig.getDatasource() returns a String of my datasource key. >I set the the retrieved datasource to Action.DATA_SOURCE_KEY to easy later >access. > >It works for me. > >Best Regards, >Dennis Lee > >-----Original Message----- >From: Jimmy Emmanual [mailto:[EMAIL PROTECTED] >Sent: Thursday, March 20, 2003 9:59 AM >To: 'Struts Users Mailing List' >Subject: RE: Connection Pool > > >Also, it seems when you have a list of datasources, the only one that is >recognized is the last one... > >-----Original Message----- >From: David Graham [mailto:[EMAIL PROTECTED] >Sent: Wednesday, March 19, 2003 7:29 PM >To: [EMAIL PROTECTED] >Subject: RE: Connection Pool > > >Are you using modules? Why don't you print out the contents of >ServletContext to see if it's in there? > >David > > > > >From: Jimmy Emmanual <[EMAIL PROTECTED]> > >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> > >Subject: RE: Connection Pool > >Date: Wed, 19 Mar 2003 19:23:40 -0500 > > > >David, > > > >When i try to access it via the defined key, the DataSource object is >null. > >The only way it works is if i use the "Action.DATA_SOURCE_KEY" i.e. > > > >ServletContext context = servlet.getServletContext(); > >DataSource dataSource = > >(DataSource)context.getAttribute(Action.DATA_SOURCE_KEY); > > > >If i try something like: > > > >ServletContext context = servlet.getServletContext(); > >DataSource dataSource = (DataSource)context.getAttribute("Datasource1"); > > > >where "Datasource1" is the "key" in the struts-config.xml file, it >doesn't > >work... > > > >-----Original Message----- > >From: David Graham [mailto:[EMAIL PROTECTED] > >Sent: Wednesday, March 19, 2003 7:23 PM > >To: [EMAIL PROTECTED] > >Subject: Re: Connection Pool > > > > > >Struts stores the DataSources in the ServletContext under the key you > >defined. > > > >David > > > > > > > > >From: Jimmy Emmanual <[EMAIL PROTECTED]> > > >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > >To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> > > >Subject: Connection Pool > > >Date: Wed, 19 Mar 2003 19:18:11 -0500 > > > > > >How do you access a DataSource from an action class via its "key"? I >have > > >multiple DataSources defined in the struts-config.xml file each have >the > > >"key" property set. I need to access these based on this "key". > > > > > >--------------------------------------------------------------------- > > >To unsubscribe, e-mail: [EMAIL PROTECTED] > > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > >_________________________________________________________________ > >The new MSN 8: advanced junk mail protection and 2 months FREE* > >http://join.msn.com/?page=features/junkmail > > > > > >--------------------------------------------------------------------- > >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] > > >_________________________________________________________________ >Tired of spam? Get advanced junk mail protection with MSN 8. >http://join.msn.com/?page=features/junkmail > > >--------------------------------------------------------------------- >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] > > >********************************************************************** >This message and any files transmitted with it are confidential and >may be privileged and/or subject to the provision of privacy legislation. >They are intended solely for the use of the individual or entity to whom >they are addressed. If the reader of this message is not the intended >recipient, please notify the sender immediately and then delete this >message. You are notifed that reliance on, disclosure of, distribution or >copying of this message is prohibited. >Bank of Bermuda >********************************************************************** > > >--------------------------------------------------------------------- >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] > >--------------------------------------------------------------------- >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] _________________________________________________________________ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail --------------------------------------------------------------------- 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]