up3 ant target gapcreatedb fails with MySQL 4.0.21
Description
Environment
Activity
I also tested this on mysql 5.0.26 using both latin1 and utf8 character sets.
Dan, thanks for the quick update. In the interim I had upgraded to MySQL 4.1.22. Your fix works withMySQL 4.1.22. I have the 4.0.21 copy of MySQL still on the test machine, so I will revert back to the 4.0.21 version of MySQL and report back.
I reduced the length of the compound key in GAP_PERMISSION to 499 and committed a gap jar with the new code to uportal3/trunk. Could you test it Elliot? Thanks.
After updating my connector url to not use unicode and enforce the use of latin1 charset, I still received the "Max key length is 500" error. I double-checked the Spring configurations and am sure that Spring is passing my connection url (with the character set parameters) as-is to the BasicDataSource.
So, I went hunting elsewhere.
Turning up debugging results in executed SQL logged to portal.log and this is the last SQL statement executed before the error is encountered:
CREATE TABLE GAP_PERMISSION(
OWNER VARCHAR(255) NOT NULL,
PRINCIPAL_TYPE INTEGER NOT NULL,
PRINCIPAL_KEY VARCHAR(255) NOT NULL,
ACTIVITY VARCHAR(255) NOT NULL,
TARGET VARCHAR(255) NULL,
PERMISSION_TYPE VARCHAR(255) NOT NULL,
EFFECTIVE TIMESTAMP NULL,
EXPIRES TIMESTAMP NULL,
CONSTRAINT PK_PERMISSION PRIMARY KEY(
OWNER,
PRINCIPAL_TYPE,
PRINCIPAL_KEY,
ACTIVITY,
TARGET)
);
Copying and pasting the SQL into my command-line client results in the same error:
mysql> CREATE TABLE GAP_PERMISSION
<...>
CONSTRAINT PK_PERMISSION PRIMARY KEY(OWNER,PRINCIPAL_TYPE,PRINCIPAL_KEY,ACTIVITY,TARGET));
ERROR 1071: Specified key was too long. Max key length is 500
mysql>
My guess is that the compound primary key is simply too big for my version of MySQL. I'll try upgrading to MySQL 5.
forgot the up3 revision: /trunk, r2880
Running ant initportal produces:
<snip>
compile:
gapcreatedb:
[echo] Invoking CreateTables
[java] Exception in thread "main" java.lang.RuntimeException: java.sql.SQLException: Specified key was too long. Max key length is 500
[java] at org.jasig.gap.db.DbUtils.jdbcExecuteStatement(DbUtils.java:98)
[java] at org.jasig.gap.db.AbstractJdbcDao.primExecute(AbstractJdbcDao.java:74)
[java] at org.jasig.gap.db.AbstractJdbcDao.createBackingStore(AbstractJdbcDao.java:43)
[java] at org.jasig.gap.db.DbInit.createBackingStore(DbInit.java:219)
[java] at org.jasig.gap.db.DbInit.createBackingStore(DbInit.java:170)
[java] at org.jasig.gap.db.DbInit.main(DbInit.java:137)
[java] Caused by: java.sql.SQLException: Specified key was too long. Max key length is 500
[java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2975)
[java] at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1600)
[java] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1695)
[java] at com.mysql.jdbc.Connection.execSQL(Connection.java:3020)
[java] at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1074)
[java] at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1008)
[java] at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:225)
[java] at org.jasig.gap.db.DbUtils.jdbcExecuteStatement(DbUtils.java:89)
[java] ... 5 more
[java] Java Result: 1