Bug 27603 - Resource params lacks nested params feature
Summary: Resource params lacks nested params feature
Status: RESOLVED WORKSFORME
Alias: None
Product: Tomcat 4
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 4.1.29
Hardware: PC All
: P3 minor (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-11 13:28 UTC by Erik W. Rasmussen
Modified: 2005-01-16 07:44 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik W. Rasmussen 2004-03-11 13:28:53 UTC
When using a JNDI datasource in Tomcat you specify something like this in the 
server.xml:

<Resource name="jdbc/revireg" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/revireg">
<parameter> 
<name>factory</name><value>org.apache.commons.dbcp.BasicDataSourceFactory</valu
e></parameter>
<parameter><name>driverClassName</name><value>com.microsoft.jdbc.sqlserver.SQLS
erverDriver</value></parameter>
<parameter> <name>url</name><value>jdbc:microsoft:sqlserver://WS-WEBREG-
QDL:1085</value></parameter>
<parameter><name>username</name><value>qdl</value></parameter>
etc ...
</ResourceParams>

Now the problem is that there is no way to specify driver specific properties. 
Fex. the MS SQL Server jdbc driver has a property called 'selectMethod' which 
can be set to either 'direct' or 'cursor'.

The BasicDataSource class used in the above configuration supports driver 
specific properties via the 'addConnectionProperty(String name, String value)' 
method. The ResourceParams class however does not support nested properties, 
ie. something like:

<ResourceParams name="jdbc/revireg">

....

<nestedparameter name="connectionProperty">
  <parameter><name>selectMethod</name><value>cursor</value></parameter>
</nestedparameter>

....

</ResourceParams>
Comment 1 Erik W. Rasmussen 2004-03-11 14:03:40 UTC
Upon closer inspection the wanted feature actually exists but is not 
documented.

The way to do it:

<ResourceParams name="jdbc/revireg">
....
<parameter><name>connectionProperties</name><value>selectMethod=cursor</value><
/parameter>
....
</ResourceParams>

Please add this to the 'Server Configuration Reference'
Comment 2 Mark Thomas 2005-01-16 16:44:32 UTC
This is a dbcp feature, not a Tomcat feature, and is included in the currect
dbcp documentation. Since it is already documented, I am resolving this as works
for me.