spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
55.3k stars 37.62k forks source link

DB2 UDB for AS/400 Not Detected As DB2 in SQLErrorCodesFactory [SPR-198] #4929

Closed spring-projects-issues closed 19 years ago

spring-projects-issues commented 19 years ago

Dustin Bruzenak opened SPR-198 and commented

When connecting to an iSeries using the IBM DB2 drivers, the SQLErrorCodes object in SQLErrorCodesFactory is not detected as a version of DB2 and is set to null.

This appears to be because the version 6 drivers return "DB2 UDB for AS/400" on the dbmdInfo.get("DatabaseProductName") call (SQLErrorCodesFactory, line 190). The check on line 193 of the same file references responses beginning with "DB2/" as DB2 and thus ignores this response.


Affects: 1.0.2

spring-projects-issues commented 19 years ago

Juergen Hoeller commented

Thanks for reporting this! I've adapted SQLErrorCodesFactory's check to startsWith("DB2"), which should cover DB2 on AS/400 too.

Juergen

spring-projects-issues commented 19 years ago

Dustin Bruzenak commented

No problem. Thanks for the quick response and for a great framework.

spring-projects-issues commented 19 years ago

Thomas Risberg commented

I added some additional functionality to this feature. We can now support wildcard expression either for trailing or leading text or also for both. You will need to add a "databaseProductName" property to the bean definition in sql-error-codes.xml. Here is an example:

\\DB2*\\

The wildcards can be specified as DB2, DB2 or DB2 depending on the matching required.

The specific DB2 test is still in the code, but it is "deprecated" and will be removed in a later release. The above mentioned functionality provides more flexibility and is a general solution that will work for other databases as well.

Thomas

spring-projects-issues commented 19 years ago

Dustin Bruzenak commented

Nice feature. Definitely better than the solution that was in place. That should allow us to grow to new DBs in the future.