• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!

 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where (at which statement) is the exception thrown? Aren't you trying to read/store a large BLOB/CLOB?
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
I am going down to the lab. Do NOT let anyone in. Not even this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic