This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts & DBCP : getting Null Datasource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts & DBCP : getting Null Datasource" Watch "Struts & DBCP : getting Null Datasource" New topic
Author

Struts & DBCP : getting Null Datasource

vijay saraf
Ranch Hand

Joined: Jan 08, 2005
Posts: 141
Hello All,
i am trying to obtain connection from database connection pool,but i am getting null object of DataSource.
Here is my code :
i have place this line in my Action Class
DataSource dataSource = getDataSource(request);
and these lines in struts-congig.xml
<data-sources>
<data-source key="connectionpool" type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" />
<set-property property="url" value="jdbc:jtds:sqlserver://vijays/master"/>
<set-property property="maxActive" value="5" />
<set-property property="username" value="myaccount" />
<set-property property="password" value="mypass" />
<set-property property="autoCommit" value="true" />
<set-property property="maxWait" value="5000" />
</data-source>
</data-sources>
i have placed all the jars in class path.
Please tell me is there any more settings needed (like jndi related..)

Thanks.
Vijay Saraf.


Thanks
Vijay Saraf.
 
Don't get me started about those stupid light bulbs.
 
subject: Struts & DBCP : getting Null Datasource
 
Similar Threads
Database Pooling in Struts
Clarification of Concept: DataSource of Struts
Struts DB Error
data-sources with oracle
How to access Datasource Tag (struts-config.xml) in POJO