You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Eric Weidner <es...@openlogic.com> on 2005/08/12 01:40:03 UTC

mailstore issue with MySQL 4.1.13

James 2.2.0
MySQL 4.1.13
Connector/J 3.1.8a

I installed James 2.2.0 with MySQL 4.1.13, changed the mysql driver to 
be com.mysql.jdbc.Driver, and added the Connector/J 4.1.8a jar in 
james-2.2.0/lib.  I am getting an error in the mailstore that says...

java.sql.SQLException: Specified key was too long; max key length is 
1024 bytes


I found the following archive thread that describes this exact issue...
http://www.mail-archive.com/server-user@james.apache.org/msg04659.html

The user solved his problem by downgrading to MySQL 4.0.x.  I don't have 
that option.


Following through with Serge's suggestions, I ran the statement in MySQL 
at the client command line...

mysql> create table users ( message_name varchar (200) not null, 
repository_name varchar (255) not null, message_statte varchar (30) not 
null, error_message varchar (200) null, sender varchar (255) null, 
recipients text not null, remote_host varchar (255) not null, 
remote_addr varchar (20) not null, message_body longblob not null, 
message_attributes longblob null, last_updated datetime not null, 
primary key (repository_name, message_name));
ERROR 1071 (42000): Specified key was too long; max key length is 1024 bytes
mysql>


If I change the statement above so that the messagename varchar length + 
the repository_name varchar length = 341 (1024/3) or lower, then the 
statement works.

Any thoughts on the problem and how to solve it?

Could I hack the sqlResources.xml and change the lengths so that they 
equal 341 only?  Does repository_name have to be 255?  If that is a 
valid option, what is the suggested ratio (200/191, 150/191, etc)?

Thanks,

Eric

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: mailstore issue with MySQL 4.1.13

Posted by Eric Weidner <es...@openlogic.com>.
I did have the default character set as UTF-8 originally.  I removed 
that and received the same thing.  Perhaps UTF-8 is the default by 
default. :)

I'll lower the field length on repository_name for now.

Thanks for the help,

Eric

David Harms wrote:
> Eric Weidner wrote, On 11/08/05 6:40 PM:
>
>> If I change the statement above so that the messagename varchar length +
>> the repository_name varchar length = 341 (1024/3) or lower, then the
>> statement works.
>
> This is happening because the character set is UTF8, in which 
> characters can be up to 3 bytes. So one option is to use a one or two 
> byte character set.
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: mailstore issue with MySQL 4.1.13

Posted by David Harms <ja...@clarionmag.com>.
Eric Weidner wrote, On 11/08/05 6:40 PM:

> If I change the statement above so that the messagename varchar length +
> the repository_name varchar length = 341 (1024/3) or lower, then the
> statement works.

This is happening because the character set is UTF8, in which characters 
can be up to 3 bytes. So one option is to use a one or two byte 
character set.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: mailstore issue with MySQL 4.1.13

Posted by Serge Knystautas <sk...@gmail.com>.
On 8/12/05, Chris Means <cm...@intfar.com> wrote:
> Is there a technical or license difference between using:
> 
>         com.mysql.jdbc.Driver
> 
> And
> 
>         org.gjt.mm.mysql.Driver

The latter is an empty child class of the former, purely for backwards
compatibility.

-- 
Serge Knystautas
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: Re: mailstore issue with MySQL 4.1.13

Posted by Stefano Bagnara <ap...@bago.org>.
> message_name is only 200 by default currently.  Are you 
> suggesting that 
> it should be increased further?

Leave message_name has it is now and use the longer reposiotry_name the db
accept.

Stefano


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: R: mailstore issue with MySQL 4.1.13

Posted by Eric Weidner <es...@openlogic.com>.
InnoDB tables.  Foreign key support is a must have.  I've been using 
MySQL 4.0.x with InnoDB tables for James 2.2.0 in the past with no issues.

BTW, if I switch to MyISAM, I get the same problem only the max key 
length is 1000 bytes instead of 1024.


message_name is only 200 by default currently.  Are you suggesting that 
it should be increased further?

Thanks,

Eric


Stefano Bagnara wrote:
>>James 2.2.0
>>MySQL 4.1.13
>>Connector/J 3.1.8a
>>    
>
>InnoDB or MyISAM tables?
>I'm almost sure I've tested MySQL 4.1.13 with MyISAM and it worked like a
>charm.
>
>  
>>If I change the statement above so that the messagename 
>>varchar length + 
>>the repository_name varchar length = 341 (1024/3) or lower, then the 
>>statement works.
>>    
>
>Don't reallly know why it need 3 bytes indexes per each char.
>
>  
>>Any thoughts on the problem and how to solve it?
>>
>>Could I hack the sqlResources.xml and change the lengths so that they 
>>equal 341 only?  Does repository_name have to be 255?  If that is a 
>>valid option, what is the suggested ratio (200/191, 150/191, etc)?
>>    
>
>I would go for 255 message_name and remaining chars for repository_name.
>
>Stefano
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>For additional commands, e-mail: server-user-help@james.apache.org
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


R: mailstore issue with MySQL 4.1.13

Posted by Stefano Bagnara <ap...@bago.org>.
> James 2.2.0
> MySQL 4.1.13
> Connector/J 3.1.8a

InnoDB or MyISAM tables?
I'm almost sure I've tested MySQL 4.1.13 with MyISAM and it worked like a
charm.

> If I change the statement above so that the messagename 
> varchar length + 
> the repository_name varchar length = 341 (1024/3) or lower, then the 
> statement works.

Don't reallly know why it need 3 bytes indexes per each char.

> Any thoughts on the problem and how to solve it?
> 
> Could I hack the sqlResources.xml and change the lengths so that they 
> equal 341 only?  Does repository_name have to be 255?  If that is a 
> valid option, what is the suggested ratio (200/191, 150/191, etc)?

I would go for 255 message_name and remaining chars for repository_name.

Stefano


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: mailstore issue with MySQL 4.1.13

Posted by Eric Weidner <es...@openlogic.com>.
The MySQL connector is GPL.  The org.gjt.mm.mysql.Driver class is 
provided for compatibility with the older mm driver.

Eric

Chris Means wrote:
>Is there a technical or license difference between using:
>
>	com.mysql.jdbc.Driver 
>
>And 
>
>	org.gjt.mm.mysql.Driver
>
>?
>
>Which are both in the Connector/J 3.1.10 jar.
>
>Thanks.
>
>-Chris
>
>-----Original Message-----
>From: Eric Weidner [mailto:esw-lists@openlogic.com] 
>Sent: Thursday, August 11, 2005 6:40 PM
>To: James-User Mailing List
>Subject: mailstore issue with MySQL 4.1.13
>
>James 2.2.0
>MySQL 4.1.13
>Connector/J 3.1.8a
>
>I installed James 2.2.0 with MySQL 4.1.13, changed the mysql driver to be
>com.mysql.jdbc.Driver, and added the Connector/J 4.1.8a jar in
>james-2.2.0/lib.  I am getting an error in the mailstore that says...
>
>java.sql.SQLException: Specified key was too long; max key length is
>1024 bytes
>
>
>I found the following archive thread that describes this exact issue...
>http://www.mail-archive.com/server-user@james.apache.org/msg04659.html
>
>The user solved his problem by downgrading to MySQL 4.0.x.  I don't have 
>that option.
>
>
>Following through with Serge's suggestions, I ran the statement in MySQL 
>at the client command line...
>
>mysql> create table users ( message_name varchar (200) not null, 
>repository_name varchar (255) not null, message_statte varchar (30) not 
>null, error_message varchar (200) null, sender varchar (255) null, 
>recipients text not null, remote_host varchar (255) not null, 
>remote_addr varchar (20) not null, message_body longblob not null, 
>message_attributes longblob null, last_updated datetime not null, 
>primary key (repository_name, message_name));
>ERROR 1071 (42000): Specified key was too long; max key length is 1024 bytes
>mysql>
>
>
>If I change the statement above so that the messagename varchar length + 
>the repository_name varchar length = 341 (1024/3) or lower, then the 
>statement works.
>
>Any thoughts on the problem and how to solve it?
>
>Could I hack the sqlResources.xml and change the lengths so that they 
>equal 341 only?  Does repository_name have to be 255?  If that is a 
>valid option, what is the suggested ratio (200/191, 150/191, etc)?
>
>Thanks,
>
>Eric
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>For additional commands, e-mail: server-user-help@james.apache.org
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>For additional commands, e-mail: server-user-help@james.apache.org
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


RE: mailstore issue with MySQL 4.1.13

Posted by Chris Means <cm...@intfar.com>.
Is there a technical or license difference between using:

	com.mysql.jdbc.Driver 

And 

	org.gjt.mm.mysql.Driver

?

Which are both in the Connector/J 3.1.10 jar.

Thanks.

-Chris

-----Original Message-----
From: Eric Weidner [mailto:esw-lists@openlogic.com] 
Sent: Thursday, August 11, 2005 6:40 PM
To: James-User Mailing List
Subject: mailstore issue with MySQL 4.1.13

James 2.2.0
MySQL 4.1.13
Connector/J 3.1.8a

I installed James 2.2.0 with MySQL 4.1.13, changed the mysql driver to be
com.mysql.jdbc.Driver, and added the Connector/J 4.1.8a jar in
james-2.2.0/lib.  I am getting an error in the mailstore that says...

java.sql.SQLException: Specified key was too long; max key length is
1024 bytes


I found the following archive thread that describes this exact issue...
http://www.mail-archive.com/server-user@james.apache.org/msg04659.html

The user solved his problem by downgrading to MySQL 4.0.x.  I don't have 
that option.


Following through with Serge's suggestions, I ran the statement in MySQL 
at the client command line...

mysql> create table users ( message_name varchar (200) not null, 
repository_name varchar (255) not null, message_statte varchar (30) not 
null, error_message varchar (200) null, sender varchar (255) null, 
recipients text not null, remote_host varchar (255) not null, 
remote_addr varchar (20) not null, message_body longblob not null, 
message_attributes longblob null, last_updated datetime not null, 
primary key (repository_name, message_name));
ERROR 1071 (42000): Specified key was too long; max key length is 1024 bytes
mysql>


If I change the statement above so that the messagename varchar length + 
the repository_name varchar length = 341 (1024/3) or lower, then the 
statement works.

Any thoughts on the problem and how to solve it?

Could I hack the sqlResources.xml and change the lengths so that they 
equal 341 only?  Does repository_name have to be 255?  If that is a 
valid option, what is the suggested ratio (200/191, 150/191, etc)?

Thanks,

Eric

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org