• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to create single connection?

 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my project i used nearly 50 struts config file.In each xml file we defined datasource and getting connection .the problem is i was used 50 struts config file so 50 connection pooling is created.please tell me how to use single datasource to all sub module without defined seperate in each xml.

i tried context.getAttribute(Action.DATA_SOURCE_KEY).BUT I this is deprecated


please tell me
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Struts definitely supports multiple configuration files to be a part of an application.

By looking at the piece of code you have given, it seems you look for the Action.DATA_SOURCE_KEY using which you obtain a single connection only.

I don't get what exactly you need further? Or can you please be a bit more specific?
 
Kaleeswaran Karuppusamy
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can i access Action.DATA_SOURCE_KEY?
my code

ServletContext context=servlet.getServletContext();
dataSource =(javax.sql.DataSource)context.getAttribute(Action.DATA_SOURCE_KEY);

error


FilterDispatchAction.java:293: cannot find symbol
symbol : variable DATA_SOURCE_KEY
location: class org.apache.struts.action.Action
dataSource =(javax.sql.DataSource)context.getAttribute(Action.DATA_SOURCE_KEY);
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic