title: JDBC: ExceptionInInitializerError when connecting to database
body: <p>I'm trying to connect to a database using the code below but I'm getting a java.lang.ExceptionInInitializerError on the console output. Anyone where the problem's coming from? Feel free to compile the code below to verify</p>
  
  <pre><code>import java.sql.ResultSet;
  import java.sql.Statement;
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.SQLException;
  
  public class RetrieveData
  {
      static final String DB_URL = "jdbc:mysql://127.0.0.1/mysql";
      static final String DB_USER = "root";
      static final String DB_PASS = "";
  
      static ResultSet result = null;
      static Connection conn = null;
      static Statement statement = null;
  
      public static void main(String args[])
      {
          try
          {
              Class.forName("com.mysql.jdbc.Driver");
              new com.mysql.jdbc.Driver();
          }
          catch(Exception e)
          {
              System.out.println("Sorry the jdbc lib was not found");
          }
  
          System.out.println("Connecting to the selected database...");
  
          try
          {
              conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PASS);
          }
          catch(SQLException e)
          {
              System.out.println("Error connecting to the selected database");
          }
  
          System.out.println("Connected to database successfully");
  
      }
  }
  </code></pre>
  
  <p>Exception trace:</p>
  
  <pre><code>java.lang.ExceptionInInitializerError
      at com.mysql.jdbc.Util.stackTraceToString(Util.java:357)
      at com.mysql.jdbc.Util.&lt;clinit&gt;(Util.java:108)
      at com.mysql.jdbc.NonRegisteringDriver.parseURL(NonRegisteringDriver.java:726)
      at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:318)
      at java.sql.DriverManager.getConnection(DriverManager.java:179)
      at java.sql.DriverManager.getConnection(DriverManager.java:213)
      at RetrieveData.main(RetrieveData.java:33)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:515)
      at com.aide.ui.build.java.RunJavaActivity$1.run(SourceFile:108)
      at java.lang.Thread.run(Thread.java:848)
  Caused by: java.lang.RuntimeException: Can't load resource bundle due to underlying exception java.util.MissingResourceException: Can't find resource for bundle 'com.mysql.jdbc.LocalizedErrorMessages_en_US', key ''
      at com.mysql.jdbc.Messages.&lt;clinit&gt;(Messages.java:54)
  ... 11 more
  Caused by: java.util.MissingResourceException: Can't find resource for bundle 'com.mysql.jdbc.LocalizedErrorMessages_en_US', key ''
      at java.util.ResourceBundle.missingResourceException(ResourceBundle.java:238)
      at java.util.ResourceBundle.getBundle(ResourceBundle.java:230)
      at java.util.ResourceBundle.getBundle(ResourceBundle.java:139)
      at com.mysql.jdbc.Messages.&lt;clinit&gt;(Messages.java:52)
      ... 11 more
  </code></pre>