Connect to MySQL: PacketTooGBigException
Hi.
I am trying to connect to MySQL database using shared-hosting host on a Ubuntu machine
I got an error message which doesn't make much sense to me:
MySQL JDBC Driver registered
Connection to mysql failed, check output console!
com.mysql.jdbc.PacketTooBigException: Packet for query is too large (3158578 > 1048576). You can change this value on the server by setting the max_allowed_packet' variable.
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:570)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1014)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2255)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2286)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2085)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:795)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:233)
at aboutMySQL.LoadDriver.main(LoadDriver.java:27)
SELECT @ @global.max_allowed_packet , @ @session.max_allowed_packet
@@global.max_allowed_packet = 268435456
@@session.max_allowed_packet = 268435456
I cannot change the max packet size as it is shared hosting.
Also, the max_allow_packet is way bigger than the packet Java sent.
Subject
Written By
Posted
Connect to MySQL: PacketTooGBigException
May 08, 2016 04:37PM
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.