-
1. Re: MySQL 4.1: Specified key was too long; max key length is
hlavacd Feb 18, 2005 1:47 PM (in response to czernay)Unless error message shows limit 1024, limit is 320 characters per key - so for each part af this key you can use only 160 charactes.
-
2. Re: MySQL 4.1: Specified key was too long; max key length is
czernay Feb 19, 2005 7:07 AM (in response to czernay)That was a typo, the error message shows limit of 1024.
The to be created table would have a primkey of two varchar-fields. A varchar-field is set to 250 in the JBoss default configuration, even if I assume two-byte characters, that would only sum up to 500 - not even close to 1024.
Nevertheless - I wonder what would be the right way to solve this issue. I don't think the right way would be to reduce the varchar standard to be 100 inside the JBoss standard-setup, as that would affect every field inside the whole application. And what would I have to do, if I had to create primkeys or indexes consisting of even more fields? That would make me end-up with even smaller varchar-fields. -
3. Re: MySQL 4.1: Specified key was too long; max key length is
darranl Feb 19, 2005 7:17 AM (in response to czernay)What table type are you using with MySQL? I think it is MyISAM tables that impose this restriction - try setting the default table type to InnoDB tables which are required for transaction support anyway.
-
4. Re: MySQL 4.1: Specified key was too long; max key length is
czernay Mar 3, 2005 11:58 AM (in response to czernay)You're right, I use the JBoss standard-settings and those don't define any table-type, that gives MyISAM on my MySQL-server. I wonder what would be the best way to set this up for InnoDB?
-
5. Re: MySQL 4.1: Specified key was too long; max key length is
darranl Mar 4, 2005 12:14 PM (in response to czernay)Are you using a my.ini or my.cnf file for MySQL?
If you add the following line to the file in the [mysqld] section.default-table-type=InnoDB
Any newly created tables should be InnoDB.
You may need to restart MySQL and if you are running it as a service you may need to reregister it to pick up the new settings. -
6. Re: MySQL 4.1: Specified key was too long; max key length is
czernay Mar 4, 2005 2:04 PM (in response to czernay)Well, I know that would work, but I can't do it - it would affect all dbs created by MySQL. Isn't there a JBoss-way of doing it?