Here i am trying to connect my java file to mysql running on my live server..but after execution i got error "packet for query is too large"..i visited other post related to the question then i got the information to increase the max_allowed_size should be greater than the packet size..even after doing the same i am not able to resolve the error.
code that i tried.
import java.sql.*;
public class MySql {
public static void main(String args[]) {
String dbURL = "jdbc:mysql://web-address:port-number/db";
String username ="uname";
String password = "pwd";
Connection dbCon = null;
Statement stmt = null;
ResultSet rs = null;
//System.out.println("connection successful");
try {
//getting database connection to MySQL server
dbCon = DriverManager.getConnection(dbURL, username, password);
System.out.println("connection successful");
} catch (Exception ex) {
System.err.println("Got an exception! ");
System.err.println(ex.getMessage());
}
}
}
error while execution is packet for query is too large (4739923>1048576). you can change this value on the server by setting the 'max_allowed_packet' variable.