Database Querying, Packet Size Limitations
So I have an applet that reads an online database, which is quite large.
When attempting to create the connection to the database, I get the following error:
To my current knowledge, I am unable to change the max_allowed_packet variable, since I believe it is controlled by my host (still checking on this).
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.
So, clearly the problem is with the size of the connection being too large. Is it possible for me to connect to my database in pieces, instead of the whole thing all at once? Maybe something like bypassing the connection to the whole database and just connecting to a specific table of the database.
If this isn't possible, I've heard rumors that one could use php or some other scripting language to do a database query and then send the data into a java applet. Is this sort of thing possible and, if it is, does anyone have any documentation I could read or suggestions to give?
Thanks in advance for any help.
Re: Database Querying, Packet Size Limitations
Try calling 'set global max_allowed_packet = 500 * 1024 * 1024' from the mysql command line (or whatever you wish your max to be). I've had this problem with MySQL in the past and was able to do this through the command line with success (you could do this on your machine be running the mysql command line tool and specify the appropriate host) - never tried it directly through JDBC but it might be worth trying (the user you login as needs to have permissions to change this global). If the large amount of data is from a single table column you are probably stuck with this option. Otherwise you might be able to piece up the query (say by looping over a limit clause) into subqueries which together get all the data.
You could have a script to do the query for you, but I don't see it as solving your initial problem.