title: Cannot Connect Java to MySQL Database
body: <p>I have database connection problem from java to mysql via LAN. I had insterted mysql connector java to the IDE Library, and ping to DBServer is success. I have change localhost to become ip address of DBServer (192.168.1.9:3306), but it is cannot connect from Java to DBServer. Why cannot connect to mysql and How to solve this problem?? I have the source code like this :</p>
  
  <pre><code>public static void Inisialisasi (){
  
  try {
  
         Class.forName("com.mysql.jdbc.Driver").newInstance();
  
              dbconn = DriverManager.getConnection("jdbc:mysql://192.168.1.9:3306/vestryl?" +
                                                   "user=root&amp;password=root");
              dbconn.setAutoCommit(false);
              //dbconn.setReadOnly(false);
              Statement stmt = dbconn.createStatement();
              Calendar cal = Calendar.getInstance();
              SimpleDateFormat sdf = new  SimpleDateFormat ("dd-MMM-yyyy HH:mm:ss z");
  
              System.out.println("Terkoneksi ke Database pada " + sdf.format(cal.getTime()));
  }
  
  catch (Exception e) {
              System.out.println("Koneksi ke DB error: " + e.getMessage());
              e.printStackTrace();
  }
  }
  </code></pre>