-
Notifications
You must be signed in to change notification settings - Fork 38.5k
NamedParameterJdbcTemplate for "insert / select" clause, set NULL value causes JConnect 7 (Sybase) problem - java.io.IOException: JZ0SL: Unsupported SQL type 0. - Affects 3.1.3.RELEASE, works in 3.1.1.RELEASE [SPR-10084] #14717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
David Boden commented Looks like the problem is caused by the range of Sybase JConnect 7 drivers that I've tried not behaving correctly when PreparedStatement.getParameterMetaData() is called. StatementCreatorUtils line 234 is: JConnect 7 throws: This may be due to a misconfiguration on the server side but:
The line is already inside a try/catch. I'd appreciate it if a defensive "catch(SQLException ex)" could be added alongside the existing "catch (AbstractMethodError err)". That would return things to the 3.1.1.RELEASE behaviour for me. |
David Boden commented I've confirmed that this is a bug with Sybase JConnect and have filed a bug report with Sybase. I'll ask them to make the bug report public and will specify the bug tracker id on here for reference. But... I could still do with the defensive "catch(SQLException ex)" to restore the previous behaviour in spite of this Sybase bug. |
David Boden commented Sybase Case# 11766880 |
Chris Beams commented Thanks, David for following up here. Please consider submitting a pull request for this per the instructions at https://github.com/SpringSource/spring-framework/blob/master/CONTRIBUTING.md. Otherwise we'll get to it as we can, thanks. |
David Boden commented Apologies, thought I already commented on this one... I've confirmed that this is fixed in 3.2.0.RELEASE ! Would appreciate it if you could close this Jira for me. |
Chris Beams commented Hi David, Resolving as requested, but note that we haven't made any changes to the framework regarding this problem. Perhaps it's environmental, or a function of an upgraded Sybase driver that it's now working. In any case, thanks for the update. |
David Boden commented Thanks Chris. I see differences between the 3.1.3 and 3.2.0 StatementUtils.java file in Maven Central: Specifically, these lines are missing from 3.2.0. Perhaps this is a regression (changes were meant to be applied to 3.2.0 but weren't)? ParameterMetaData pmd = null;
try {
pmd = ps.getParameterMetaData();
}
catch (AbstractMethodError err) {
// JDBC driver not compliant with JDBC 3.0
// -> proceed with database-specific checks
}
if (pmd != null) {
sqlType = pmd.getParameterType(paramIndex);
}
else { |
Chris Beams commented Thanks, David. Will look back into this. |
Juergen Hoeller commented Indeed, I've accidentally applied this to the 3.1.x branch only. To be fixed for 3.2.1. Juergen |
Chris Beams commented Looks like this showed up in 3.1.x with commit 79d9f7a5f731268a4a999ce45e0579f3c512a2f6. |
David Boden commented Thanks. This is probably obvious to you, but just wanted to make it clear that applying the patch as-is to the 3.2.x codebase will introduce the problem I've reported to the 3.2.x branch too. Hopefully this Jira represents fixing the current on the 3.1 stream and applying both the original commit and the fix to the 3.2 stream? |
Juergen Hoeller commented Applied to both branches with minor modifications for defensiveness against the JDBC driver now, as you suggested above. Juergen |
David Boden opened SPR-10084 and commented
On a SQL query that involves:
insert into AbcTable
select :param1, :param2, otherValue
from DefTable
... using a NamedParameterJdbcTemplate and mapping one of the named parameters to NULL in the parameter map results in:
java.io.IOException: JZ0SL: Unsupported SQL type 0.
Example code (Spring 3.1.3.RELEASE):
MapSqlParameterSource parameters = new MapSqlParameterSource();
parameters.addValue("param1", null);
template.update(insertSql, parameters);
Works (inserts a null value into the table) in 3.1.1.RELEASE.
Using Sybase JConnect 7.07.ESD5 (latest) and other versions of JConnect spanning back 2 years.
Test details to follow on Monday, just wanted to raise the issue.
Affects: 3.1.3
Issue Links:
Referenced from: commits f449b5a, f0a1ff2
Backported to: 3.1.4
The text was updated successfully, but these errors were encountered: