001package io.ebean.config.dbplatform.db2; 002 003import io.ebean.annotation.Platform; 004import io.ebean.config.dbplatform.DbPlatformType; 005import io.ebean.config.dbplatform.DbType; 006import io.ebean.config.dbplatform.SqlErrorCodes; 007 008import java.sql.Types; 009 010/** 011 * DB2 specific platform for i Series. 012 * 013 * @author Cédric Sougné 014 */ 015public class DB2ForIPlatform extends BaseDB2Platform { 016 017 public DB2ForIPlatform() { 018 super(); 019 this.platform = Platform.DB2FORI; 020 // Note: IBM i from 7.1 allow up to to 128 021 // TODO: Check if we need to introduce older platform (DB2ForI_6 ? but older 022 // documentation is not anymore published on ibm.com), 023 this.maxTableNameLength = 128; 024 this.maxConstraintNameLength = 128; 025 026 this.dbIdentity.setSupportsIdentity(true); 027 028 this.exceptionTranslator = new SqlErrorCodes().addAcquireLock("57033") // key -913 029 .addDuplicateKey("23505") // -803 030 // .addDataIntegrity("-407","-530","-531","-532","-543","-544","-545","-603","-667") 031 // we need SQLState, not code: 032 // https://www.ibm.com/support/knowledgecenter/en/SSEPEK_10.0.0/codes/src/tpc/db2z_n.html 033 .addDataIntegrity("23502", "23503", "23504", "23507", "23511", "23512", "23513", "42917", "23515") 034 .build(); 035 036 booleanDbType = Types.SMALLINT; 037 dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("smallint default 0")); 038 } 039}