B4J Question Quick help PLEASE... (PacketTooBigException) error when trying to connect to remote mySql database

MegatenFreak

Active Member
Licensed User
Hi. I'd appreciate any quick help please.
I'm trying to connect to a mySQL database on my website. Here's the jSQL function:

B4X:
sql1.InitializeAsync("sql1", "com.mysql.cj.jdbc.Driver", "jdbc:mysql://amin-azma.com:2083/amin_lims?characterEncoding=utf8&useSSL=false", "username", "password")
[username and password aren't mentioned here of course!]
It used to work when on localhost, but now after a long time of waiting, I get the error:

com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large (5,526,600 > 65,535). You can change this value on the server by setting the 'max_allowed_packet' variable.

Please help... what is the problem? The website url and port are just as shown in my browser. How do I find where the query gets stuck???
Thank you so much in advance.
 
Last edited:

MegatenFreak

Active Member
Licensed User
Please use [code]code here...[/code] tags when posting code.

Does it happen in the initialization step? Or after you send a query?
Hi Erel. It happens in the initialization, the very first step. I can't even connect to the database.
by the way, I've added my IP to the server's cpanel to allow access to the databases...
If this doesn't work in the end, what should I do? I can't use jRDC because the site is not a VPS so I can't install a B4J server on it...😭😭😭
Any help would be greatly appreciated
 
Last edited:

MegatenFreak

Active Member
Licensed User
Thanks Erel. I checked it out. It turns out the ultimate problem is that it is a shared cpanel host and simply doesn't allow remote database connections even if I tried.
So, I resorted to another method: I wrote php code that acts as a proxy for database queries and put it on the server. Then in B4J I use httpjob to communicate with that php using json strings. I'm only worried about the security aspect though.
 
Top