• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"max_allowed_packet" issue still happen even after MYSQL is already updated with a High value

 
Ken Liao
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a very strange issue; MYSQL max_allowed_packet is already set as 32MB;

max_allowed_packet 33554432


And below is my JDBC code to get MYSQL connection:


String url = "jdbc:mysql://" + server + ":" + port;
if (database != null)
url += "/" + database;
url = url + "?user=" + username + "&password=" + password;
connection = DriverManager.getConnection(url);


But it still throw out exception that max_allowed_packet is too small;

com.mysql.jdbc.PacketTooBigException: Packet for query is too large (4739923 > 1048576). You can change this value on the server by setting the max_allowed_packet' variable.


Can someone know why this happen? or is there any other place may cause this issue too?


Thanks!

 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where (at which statement) is the exception thrown? Aren't you trying to read/store a large BLOB/CLOB?
 
Scott Selikoff
author
Saloon Keeper
Posts: 4031
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if this is on topic, but you can modify your connection request string to include max packet as a parameter.

See reference page for more detail: 20.3.5.1. Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic