title: Connect to mysql remote database using JDBC?
body: <p>I'm a java beginner and I'm working on a simple application which connects to a remote mysql database using JDBC. I've tested it locally and it works just fine, however I cannot get it to work on for my remote server.
  I don't think its of much use but heres the code:</p>
  
  <pre><code>Connection connection = null;
  String dburl = "jdbc:mysql://314159265:3306/Db_Name";
  String userName = "user";
  String passWord = "password";
  
      try {
          Class.forName("com.mysql.jdbc.Driver");
  
          connection = DriverManager.getConnection(dburl, userName, passWord);
          Statement st = connection.createStatement();                                 
  
          String query = "INSERT INTO Example (`TestColumn`) VALUES('hello')";
          int rsI = st.executeUpdate(query);
          System.out.println("Hi");
          }catch (Exception e) {
          System.out.println(e);
      } finally {
          if (connection != null) {
              try {
                  connection.close();
                  System.out.println("Database connection terminated");
              } catch (Exception e) { /* ignore close errors */ }
          }
      }
  </code></pre>
  
  <p>When I run this, I get the following message:</p>
  
  <pre><code>com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  The last packet sent successfully to the server was 0 milliseconds ago.The driver has not received any packets from the server.
  </code></pre>
  
  <p>I'm pretty sure it must be some kind of server configuration issue.</p>
  
  <pre><code> Notes:
   Username, password, IP, database name, etc. are just examples.
  </code></pre>