Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » com.mysql.jdbc.PacketTooBigException
com.mysql.jdbc.PacketTooBigException [message #1731649] Mon, 09 May 2016 01:07 Go to next message
Arthur Chan is currently offline Arthur ChanFriend
Messages: 44
Registered: September 2015
Member
Hi.

I am trying to connect to MySQL database using shared-hosting host on a Ubuntu machine from my laptop running Eclipse on Windows 7

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)


Some checks I did, which shows that my sesssion max allowed packet size is many time bigger than what Java Eclipse sent

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 on a shared hosting server
Also, the max_allow_packet is way bigger than the packet Java sent.

What can I do at my end?
I saw many similar questions on different forums, maybe it is a bug with MySQL?
Re: com.mysql.jdbc.PacketTooBigException [message #1731741 is a reply to message #1731649] Mon, 09 May 2016 17:35 Go to previous message
Arthur Chan is currently offline Arthur ChanFriend
Messages: 44
Registered: September 2015
Member
RESOLVED!

Beware the port number, the guys at the host end gave me wrong port number. Sad
Try telnet-ting into the port, see if you can connect.
This connection string works for me:

conn = DriverManager.getConnection("jdbc:mysql://<ip-address>:3306/dbName?maxAllowedPacket=3158578", "username", "password");

Previous Topic:How do I open Javadoc in a different window?
Next Topic:Javadoc not working
Goto Forum:
  


Current Time: Tue Oct 15 15:56:59 GMT 2024

Powered by FUDForum. Page generated in 0.03172 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top