Reputation: 671
I'm working on a project and I have a java program that parses a bunch of files and breaks them into records which are to be stored within a database. I've tested the program on my own server using the following (intellij generated) string:
And the above string works fine in the code and all the data is stored
But when I try to connect to the (external) project database located at 104.131.96.199 using the following
(There are two open ports: 22 and 80)
On port 80 it hangs on "connecting to database" forever (over 10 mins),
and on port 22 I get the packet size error above.
I've gone into phpmyadmin and changed the max_allowed_packet variable to 4739923, but still get the same issue (the change still isn't reflected in the error).
I'm not in charge of this db, although I have the admin user and pass. Any help in the matter would be greatly appreciated
I guess I have 2 questions:
Upvotes: 0
Views: 856
Reputation: 185
1.) Yes, the URL is syntactically correct. If you want to specify a user and password, you can add ?user=<username>&password=<password>
to the end of the String.
2.) It most likely doesnt work because you are apparently using the SSH port (22) and the HTTP port (80) instead of the MySQL port (3306). If these are the only two open ports you will have to ask the server admin to manually allow remote connections to his MySQL server
Upvotes: 1
Reputation: 736
Syntax is correct.
packet size issue - The changes to max_allowed_packet have possibly not taken effect. Run the below to check the value:
SHOW VARIABLES LIKE 'max_allowed_packet';
hanging forever - Check that the port used is correct.
Upvotes: 0