Connection conn = null; try { conn=DriverManager.getConnection("jdbc:mysql://tommy.heliohost.org:2083/db?","user","pass"); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select something from table"); while(rs.next()) { System.out.println(rs.getInt(1)); } // Do something with the Connection } catch (SQLException ex) { // handle any errors System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); } is this connection is ok because still the same error of packet too large