File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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.
 
Consider Paul's rocket mass heater.
 
subject: Struts & DBCP : getting Null Datasource