IBM DB2

Requirements

IBM DB2 support relies on the IBM DB2 .NET provider, shipped with the latest ClientAccess version, also available through the DB2 personal edition installation, or through the IBM website for DB2 licensees. To be able to create a model from an existing DB2 schema, you have to have access to a DB2 instance, version v7.x. IBM DB2 on AS\400 / iSeries isn't supported.

Supported features

Feature Supported
Minimal database version DB2 v7.x
Database types All built-in types
User defined types No
Foreign key constraints Yes
Primary key constraints Yes
Unique constraints Yes
Check constraints No
Default values Yes
Unique indexes No
Tables Yes
Views Yes
Stored Procedures Yes
Table Valued Functions No
(System versioned) Temporal tables Yes, both Business Time and System Time oriented temporal tables.
Synonyms NO
Cascade delete rules No
Cascade update rules No
Identity fields Yes
System sequences Yes
Schema based sequences Yes
Multiple catalogs per project No
Multiple schemas per catalog Yes
Linked servers No

Type mappings

Below you'll find the two type mapping tables used by the IBM DB2 driver of LLBLGen Pro. One is used for Database First development, the other is used for Model First development. In case of Model First development, you can add your own type shortcuts to define a different target database type, in case the default mappings aren't what you need in a particular case.

Global model-first type overruling

For Model first, there are often multiple database types defined per .NET Type and a given filter. To prefer one over the other on a global level, please look at the following settings in the Relational model data element construction section of the Project Settings:

  • Prefer natural character types
  • Prefer decimal over currency types
  • Prefer variable length types

Database first type mappings

You can control the .NET type during reverse engineering in database first development by defining Type Conversions in the Project Settings, which are based on Type Converters.

Database type .NET Type
BigInt System.Int64
Binary Large Object System.Byte[]
Blob System.Byte[]
Char For Bit Data System.Byte[]
Char Large Object System.String
Char Varying For BitData System.Byte[]
Char Varying System.String
Character For Bit Data System.Byte[]
Character Large Object System.String
Character Varying For BitData System.Byte[]
Character Varying System.String
Character System.String
Char System.String
Clob System.String
Date System.DateTime
DbClob System.String
Decimal System.Decimal
Dec System.Decimal
Double Precision System.Double
Double-Byte Char Large Object System.String
Double-Byte Character Large Object System.String
Double System.Double
Float System.Double
Graphic Varying System.String
Graphic System.String
Integer System.Int32
Int System.Int32
Long Graphic Varying System.String
Long VarChar For BitData System.Byte[]
Long VarChar System.String
Long VarGraphic System.String
Numeric System.Decimal
Num System.Decimal
Real System.Single
SmallInt System.Int16
TimeStamp System.DateTime
Time System.TimeSpan
VarChar For BitData System.Byte[]
VarChar System.String
VarGraphic System.String
Xml System.String

Model first type mappings

If specified, the filter is combined with the .NET type to determine the database type. The elements length, precision and scale are the max. length, precision and scale of an entity field with the particular .NET Type. For instance a field with type System.String, max. length set to 50, will with all defaults enabled, a database type of NVarChar(50).

If a controlling setting is specified, that setting has to be set to the specified value (in the Relational model data element construction section of the Project Settings) to make the designer select that database type.

.NET Type Filter Database type Controlling setting and value
System.Byte[] 0 < length < 32672 VarCharForBitData(length)
System.Byte[] length==0 or length >= 32672 Blob
System.DateTime Date
System.Decimal Decimal(precision, scale) Prefer decimal over currency types set to true
System.Double Float
System.Int16 SmallInt
System.Int32 Int
System.Int64 BigInt
System.Single Real
System.String 0 < length < 254 Char(length) Prefer variable length types set to false
System.String 0 < length < 254 VarChar(length) Prefer variable length types set to true
System.String 255 < length < 32672 VarChar(length)
System.String length==0 or length >= 32672 Clob
System.TimeSpan Time

Supported target frameworks

The following target frameworks are supported with IBM DB2:

  • LLBLGen Pro Runtime Framework
  • Entity Framework v1-v6
  • NHibernate