[ https://issues.apache.org/jira/browse/GROOVY-8128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15938083#comment-15938083 ]
Mike Sauer commented on GROOVY-8128: ------------------------------------ Here is my stack trace: {noformat} at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190) at com.microsoft.sqlserver.jdbc.SQLServerParameterMetaData.<init>(SQLServerParameterMetaData.java:426) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.getParameterMetaData(SQLServerPreparedStatement.java:1532) at groovy.sql.Sql.setParameters(Sql.java:4109) at groovy.sql.Sql.getPreparedStatement(Sql.java:4383) at groovy.sql.Sql.getPreparedStatement(Sql.java:4471) at groovy.sql.Sql.eachRow(Sql.java:1262) at groovy.sql.Sql.eachRow(Sql.java:1350) at groovy.sql.Sql.eachRow(Sql.java:1530) at groovy.sql.Sql.eachRow(Sql.java:1614) at groovy.sql.Sql$eachRow.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133) at ConsumerTaxDBExtract.queryRetail(ConsumerTaxDBExtract.groovy:18) {noformat} Also, I get the same error if I remove the SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED\r\n\ line. > Breaking change in 2.4.9 with Sql query with GString > ---------------------------------------------------- > > Key: GROOVY-8128 > URL: https://issues.apache.org/jira/browse/GROOVY-8128 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime > Affects Versions: 2.4.9 > Environment: Windows 7 > Reporter: Mike Sauer > Priority: Critical > > The following code worked for releases 2.4.8 and below: > {code} > def query = """\ > SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED\r\n\ > select u5f_documenttype from DocVersion dv left outer join > ClassDefinition cd on dv.object_class_id = cd.object_id > where cd.symbolic_name in ('Retail', 'RetailWeb') and dv.is_current = 1 > and u59_accountnumber = $acctNum and u5f_documenttype = 'Signature Card' > """ > def docFound = 'No Doc' > consumerSql.eachRow(query) { > {code} > This code now fails in 2.4.9 and 2.4.10 with: > {noformat} > Mar 22, 2017 9:23:43 AM groovy.sql.Sql eachRow > WARNING: Failed to execute: SET TRANSACTION ISOLATION LEVEL READ > UNCOMMITTED > select u5f_documenttype from DocVersion dv left outer join > ClassDefinition cd on dv.object_class_id = cd.object_id > where cd.symbolic_name in ('Retail', 'RetailWeb') and dv.is_current = 1 > and u59_accountnumber = ? and u5f_documenttype = 'Signature Card' > because: com.microsoft.sqlserver.jdbc.SQLServerException: Unable to > identify the table SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED > select u5f_documenttype from DocVersion dv left outer join > ClassDefinition cd on dv.object_class_id = cd.object_id > where cd.symbolic_name in ('Retail', 'RetailWeb') and dv.is_current = 1 > and u59_accountnumber = ? and u5f_documenttype = 'Signature Card' > for the metadata. > {noformat} > I have tried changing to using placeholders and name parameters and I get > similar results. -- This message was sent by Atlassian JIRA (v6.3.15#6346)