Bug 7218 - Transactions and Data Sources
Summary: Transactions and Data Sources
Status: RESOLVED FIXED
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-18 20:05 UTC by David Geary
Modified: 2004-11-16 19:05 UTC (History)
1 user (show)



Attachments
one of two patches that resolves this bug (837 bytes, patch)
2002-04-05 07:01 UTC, Jin Choi
Details | Diff
second of two patches that fixes this bug (837 bytes, patch)
2002-04-05 07:02 UTC, Jin Choi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Geary 2002-03-18 20:05:04 UTC
When I try this:

<sql:transaction>
   <sql:update>
               INSERT INTO CUSTOMERS ('1', 'Joe White',
               '(221)552-8244', '142 Moor Dr.' 'Houston', 'Texas')

               INSERT INTO CUSTOMERS ('2', 'Bill Black',
               '(301)453-9284', '1 Scott Dr.' 'Sequim', 'Washington')
   </sql:update>
</sql:transaction>

I get this exception:

javax.servlet.ServletException: It is illegal to specify a DataSource when 
nested within a <transaction>
...

From reading the spec, it appears that the preceeding code is valid.
Comment 1 Jin Choi 2002-04-05 07:01:26 UTC
Created attachment 1486 [details]
one of two patches that resolves this bug
Comment 2 Jin Choi 2002-04-05 07:02:02 UTC
Created attachment 1487 [details]
second of two patches that fixes this bug
Comment 3 Jin Choi 2002-04-05 07:05:49 UTC
Oops. I attached two patches to this bug; they don't say what files they are 
for. The first is for UpdateTagSupport.java, the second for 
QueryTagSupport.java, in org.apache.taglibs.standard.tag.common.sql.

In fact, the error thrown is more in the realm of syntax checking than an 
actual error, since even if an explicit datasource is specified it would be 
ignored.
Comment 4 Justyna Horwat 2002-04-08 21:33:43 UTC
Jin, thanks for the patches. I looked them over and you're right, the error
stemmed from not differentiating between transparent and explicit collaboration
when verifying how the dataSource object was set. 

Unfortunately I can't just check to see if the datasource scoped variable is
null or not. I must know whether the query or the update tag have a datasource
attribute and are nested in a transaction tag. For that purpose, I have a
rawDataSource object that is set if the tags include the attribute. I changed
the logic to test whether the rawDataSource was set or not in a nested query or
update action.