DdlUtils
  1. DdlUtils
  2. DDLUTILS-250

The DB2Builder makes column names to short

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.0
    • Fix Version/s: None
    • Component/s: Core - DB2
    • Labels:
      None
    • Environment:
      Windows, DB2 9.5

      Description

      The DB2Platform class restricts column names to 18 characters (or 30 for Db2v8Platform), which is fine for legacy DB2. These days DB/2 supports column names with up to 128 bytes (DB2 9.7) .

      Since DB2 9.X will use DB2Platform (and not Db2v8Platform) the maxColumnNameLength will be set to 18 for DB2 9.X database connections. Because of this the DB2Builder will shorten column names longer than 18, which in many conditions is to short.

      Possible solutions:

      • autodetect DB2 version and set the "maxColumnNameLength" and property accordingly (the best fix IMHO as it only affects DB2 implementation)
      • make it posible to override this setting by either provide a property set to PlatformFactory (breaks the idea of hiding DBMS specific implementation details to the DDLutils user)

        Activity

        Hide
        Sondre Eikanger Kvalø added a comment -

        A workaround is to invoke PlatformFactory.registerPlatform(Db2Platform.DATABASENAME, Db2v8Platform.class); prior to calling PlatformFactory.createNewPlatformInstance(DataSource). You will then get a Db2v8Platform object instead of a Db2Platform object (maxColumnNameLength will then be 18 characters).

        Show
        Sondre Eikanger Kvalø added a comment - A workaround is to invoke PlatformFactory.registerPlatform(Db2Platform.DATABASENAME, Db2v8Platform.class); prior to calling PlatformFactory.createNewPlatformInstance(DataSource). You will then get a Db2v8Platform object instead of a Db2Platform object (maxColumnNameLength will then be 18 characters).

          People

          • Assignee:
            Thomas Dudziak
            Reporter:
            Sondre Eikanger Kvalø
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development