aspose file tools*
The moose likes Struts and the fly likes How to create single connection? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to create single connection?" Watch "How to create single connection?" New topic
Author

How to create single connection?

Kaleeswaran Karuppasamy
Ranch Hand

Joined: Jul 19, 2007
Posts: 154
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


Judge a man by his questions rather than his answers --Voltaire
SCJP 1.5 97%
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

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?


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Kaleeswaran Karuppasamy
Ranch Hand

Joined: Jul 19, 2007
Posts: 154
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);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to create single connection?