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.
Created attachment 1486 [details] one of two patches that resolves this bug
Created attachment 1487 [details] second of two patches that fixes this bug
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.
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.