Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting max_allowed_packet

Status
Not open for further replies.

sjohri214

Programmer
Jul 19, 2002
24
0
0
GB
Hi all,

I am having a problem with adding a large String to a mySQL field.. The size of the String is ~ 4MB and the datatype of the field to which I am inserting the string is - longtext.

When I try to insert the String I get errors - i.e.
"com.mysql.jdbc.PacketTooBigException"

I have tried to set the max_allowed_packet value, in the my.ini file.
i.e. set-variable =max_allowed_packet=16M

although, when I try again to repeat the process once I have set the max_allowed_packet.. I still get the same error Message. It seems that even when I set the max_allowd_packet to 16M, the actual allowed maximum value is 1M.

I hope someone can help with this

Thanks
 
You have to restart the server for the changes in the .ini
file to take affect.

Note that both the client and the server has it's own max_allowed_packet variable. If you want to handle big packets, you have to increase this variable both in the client and in the server. If both the client and the server
are on the same machine then disregard this.



If you are using the mysql client, you may specify a bigger buffer by starting the client with mysql --set-variable=max_allowed_packet=8M. Other clients have different methods to set this variable. Please note that --set-variable is deprecated since MySQL 4.0, just use --max-allowed-packet=8M instead.
 
Thanks for the help Vanekl.. that did the trick

thanks again.. much appreciated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top