Skip navigation links

MySQL Forums :: Connector/JDBC and Java :: 'Packet for query is too large' exception when connecting


Advanced Search

'Packet for query is too large' exception when connecting
Posted by: Mark Zalavari ()
Date: October 26, 2012 11:45AM

Hi!

I have this exception when I create a connection:

Caused by: 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.
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:605)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1078)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2397)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2430)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2215)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:813)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:334)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:193)
at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:281)
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:297)


I already set the max_allowed_packet on server side, restarted the server, and I see the change on the mysql console. So the server side seems ok.


Cannot find any solution yet. I checking the driver's source (5.1.21) for clues. The only thing I found for now, is that the default value for this variable on client side is 1M. I suppose it should change only after a successful connection.
Maybe the connection packet is too large for some reason? So maybe it is a server side problem. But what kind of problem can be this?
(server version: 5.5.24)

Thanks for any advice in advance!

Options: ReplyQuote


Subject Written By Posted
'Packet for query is too large' exception when connecting Mark Zalavari 10/26/2012 11:45AM
Re: 'Packet for query is too large' exception when connecting Mark Zalavari 10/26/2012 01:20PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.