Not DB2 is truncating it. You are doing it in:
DB2Database.class public String generatePrimaryKeyName(String tableName) { String pkName = super.generatePrimaryKeyName(tableName); if (pkName.length() > 18) { pkName = pkName.substring(0, 17); } return pkName; } This way we have two times the same name, because "PK_DATABASECHANGELOGLOCK" is truncated down to "PK_DATABASECHANGE", same goes for "PK_DATABASECHANGELOG", which also will be truncated to "PK_DATABASECHANGE". I wonder if this will work on DB2 UDB for Linux/Windows. --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 02.06.2009 um 17:24 schrieb Voxland, Nathan: > Other databases have that problem too. I think the issue is actually > that our PK names are too long and db2 is truncating it down to a > non-unique version. Normally, I think it is PK_DATABASECHANGELOG and > PK_DATABASECHANGELOGLOCK > > Nathan > > -----Original Message----- > From: Marc Logemann [mailto:l...@logemann.org] > Sent: Tuesday, June 02, 2009 9:25 AM > To: liquibase-user@lists.sourceforge.net > Subject: Re: [Liquibase-user] duplicate Key on Liq Table creation > > Thanks for the ramp-up infos. It would be very nice if you could name > the key constraints differntly. On iSeries there will be an error when > you create PK_DATABASECHANGE more than one time. On other DBs, the > name is ascociated with the table where the key is for, but not on > iSeries. There we have a common pool of names for all tables! > > --- > regards > Marc Logemann > http://www.logemann.org > http://www.logentis.de > > > > > Am 01.06.2009 um 22:40 schrieb Voxland, Nathan: > >> If you are interested in adding support, that would be great. The >> easiest way is to register on liquibase.jira.com, check out the code >> using your username/password, and commit what you need to change. We >> are >> experimenting with >> >> The state of the code right now, is that there are two major >> branches: >> /branches/1_9 and /trunk. Trunk is in the process of a major >> refactoring which will hopefully be done in about a month. While >> that >> would be the best place to add it, it may not be in the state to jump >> into adding new dialect support. >> >> Your best bet will probably be to check out /branches/1_9 and add it >> there. We can always merge the changes into trunk later on. You can >> take a look at any of the Database implementations (DB2Database may >> be a >> good starting point). There is an AbstractSampleChangeLogRunnerTest >> class you can extend as well to provide a good automated test of your >> new dialect. See DB2SampleChangeLogRunnerTest for an example. >> >> Let me know if you have any questions >> >> Nathan >> >> -----Original Message----- >> From: Marc Logemann [mailto:l...@logemann.org] >> Sent: Monday, June 01, 2009 7:30 AM >> To: liquibase-user@lists.sourceforge.net >> Subject: Re: [Liquibase-user] duplicate Key on Liq Table creation >> >> Hi, >> >> ok, replying to myself after some hours of investigation: >> >> 1) we need to define a new DB dialiect in Liquibase which is called >> "DB2 for iSeries". The DB2 on this platform, while mostly SQL level >> compliant has some quirks when it comes to MetaData handling. Its a >> different driver also which is used on this platform. I could start >> cloning the original DB2 and make some changes. With current version, >> Liquibase handles it like a normal DB2 DB because the proprietary >> product name (defined in driver) starts also with DB2 (DB2 UDB for >> iSeries). >> >> 2) my problem mentioned is there because of the call in >> AbstractDatabase.doesChangeLogLockTableExist() >> >> rs = >> connection >> .getMetaData >> ().getTables(convertRequestedSchemaToCatalog(getDefaultSchemaName()), >> convertRequestedSchemaToSchema(getDefaultSchemaName()), >> getDatabaseChangeLogLockTableName(), new String[]{"TABLE"}); >> >> just doesnt work. On DB2 for ISeries its a bad idea to supply "null" >> as schema name. It uses some user profile defaults to determine the >> default schema instead of just looking at some very prominent JDBC >> url >> parameters for the jt400 driver. >> >> The mother of all my problems is, that every call to getTables() just >> doesnt work or better, results in a result-set without any rows. So >> Liquibase thinks there are no tables. In my case he thinks that its >> DBCHANGELOG tables are not there, but they are. >> >> So as long as DB2 for iSeries is different in some ways (and to my >> knowledge, this will be the case for the time being), you have to >> handle it differently. This also applies for nearly ALL SQL clients >> available. I am using DBVisualizer which is really good but it also >> fails with some DB2 for iSeries thingies because of the non-existant >> DB2 abstraction for this platform. >> >> So i am willing to help out there and hope patches are appreciated. >> >> --- >> regards >> Marc Logemann >> http://www.logemann.org >> http://www.logentis.de >> >> >> >> >> Am 30.05.2009 um 00:41 schrieb Marc Logemann: >> >>> Hi, >>> >>> i am trying to use liquibase to bootstrap a complete DB schema, >>> thus i >>> dont have any tables. Only the schema. Normally Liquibase creates >>> its >>> two management tables and then runs the changeset. This works with >>> MySQL but with DB2 for iSeries, i am getting the following stack. It >>> seems Liquibase use a Constraint names two times. Lquibase wants to >>> create "PK_DATABASECHANGE" two times. >>> >>> java.sql.SQLException: [SQL0601] PK_DATABASECHANGE der Art * in >>> NETVERSYS2 bereits vorhanden. >>> at >>> com.ibm.as400.access.JDError.throwSQLException(JDError.java:650) >>> at >>> com.ibm.as400.access.JDError.throwSQLException(JDError.java:621) >>> at >>> com >>> .ibm >>> .as400 >>> .access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java: >>> 1378) >>> at >>> com >>> .ibm >>> .as400.access.AS400JDBCStatement.execute(AS400JDBCStatement.java: >>> 1729) >>> at >>> org >>> .apache >>> .commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java: >>> 264) >>> at liquibase.database.template.JdbcTemplate >>> $1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:78) >>> at >>> liquibase.database.template.JdbcTemplate.execute(JdbcTemplate.java: >>> 48) >>> at >>> liquibase.database.template.JdbcTemplate.execute(JdbcTemplate.java: >>> 86) >>> at >>> liquibase >>> .database >>> .AbstractDatabase >>> .checkDatabaseChangeLogLockTable(AbstractDatabase.java:712) >>> at liquibase.lock.LockHandler.acquireLock(LockHandler.java:40) >>> at liquibase.lock.LockHandler.waitForLock(LockHandler.java:150) >>> at liquibase.Liquibase.listUnrunChangeSets(Liquibase.java:518) >>> >>> The SQL message is in german, it translates to: >>> >>> java.sql.SQLException: [SQL0601] PK_DATABASECHANGE of Type * in >>> NETVERSYS2 already existant. >>> >>> And in fact it already exists because Liquibase already created its >>> first (the lock table) entity. It seems it wants to create the >>> second >>> with the same constraint name. Can this be? >>> >>> --- >>> regards >>> Marc Logemann >>> http://www.logemann.org >>> http://www.logentis.de >>> >>> >>> >>> >>> >>> >> > ------------------------------------------------------------------------ >> ------ >>> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT >>> is a gathering of tech-side developers & brand creativity >>> professionals. Meet >>> the minds behind Google Creative Lab, Visual Complexity, >>> Processing, & >>> iPhoneDevCamp as they present alongside digital heavyweights like >>> Barbarian >>> Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com >>> _______________________________________________ >>> Liquibase-user mailing list >>> Liquibase-user@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/liquibase-user >> >> >> > ------------------------------------------------------------------------ >> ------ >> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT >> is a gathering of tech-side developers & brand creativity >> professionals. >> Meet >> the minds behind Google Creative Lab, Visual Complexity, >> Processing, & >> iPhoneDevCamp as they present alongside digital heavyweights like >> Barbarian >> Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com >> _______________________________________________ >> Liquibase-user mailing list >> Liquibase-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/liquibase-user >> >> > ------------------------------------------------------------------------ > ------ >> OpenSolaris 2009.06 is a cutting edge operating system for >> enterprises >> looking to deploy the next generation of Solaris that includes the >> latest >> innovations from Sun and the OpenSource community. Download a copy >> and >> enjoy capabilities such as Networking, Storage and Virtualization. >> Go to: http://p.sf.net/sfu/opensolaris-get >> _______________________________________________ >> Liquibase-user mailing list >> Liquibase-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/liquibase-user > > > ------------------------------------------------------------------------ > ------ > OpenSolaris 2009.06 is a cutting edge operating system for enterprises > looking to deploy the next generation of Solaris that includes the > latest > innovations from Sun and the OpenSource community. Download a copy and > enjoy capabilities such as Networking, Storage and Virtualization. > Go to: http://p.sf.net/sfu/opensolaris-get > _______________________________________________ > Liquibase-user mailing list > Liquibase-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/liquibase-user > > ------------------------------------------------------------------------------ > OpenSolaris 2009.06 is a cutting edge operating system for enterprises > looking to deploy the next generation of Solaris that includes the > latest > innovations from Sun and the OpenSource community. Download a copy and > enjoy capabilities such as Networking, Storage and Virtualization. > Go to: http://p.sf.net/sfu/opensolaris-get > _______________________________________________ > Liquibase-user mailing list > Liquibase-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/liquibase-user ------------------------------------------------------------------------------ OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get _______________________________________________ Liquibase-user mailing list Liquibase-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/liquibase-user