title: How do I permit my Java applet to use MySQL?
body: <p>I've recently gotten my hobby java project embedded into a page <a href="https://stackoverflow.com/questions/138157/java-console-like-web-applet">thanks to this very site</a>, but now I'm having some security issues.</p>
  
  <p>I have the include:</p>
  
  <pre><code>import java.sql.*;
  </code></pre>
  
  <p>and the line:</p>
  
  <pre><code>Class.forName("com.mysql.jdbc.Driver").newInstance();
  </code></pre>
  
  <p>as well as a mysql .jar file in my src directory, it works from the console, and in the applet works fine from the applet - up until that forName() line in my code, where it throws the exception:</p>
  
  <pre>
      Exception: com.mysql.jdbc.Driverjava.lang.ClassNotFoundException: com.mysql.jdbc.Driver
      java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.-1)
      at java.security.AccessControlContext.checkPermission(Unknown Source)
      at java.security.AccessController.checkPermission(Unknown Source)
      at java.lang.SecurityManager.checkPermission(Unknown Source)
      at java.lang.SecurityManager.checkExit(Unknown Source)
      at java.lang.Runtime.exit(Unknown Source)
      at java.lang.System.exit(Unknown Source)
      at applet.Database.connectDB(Database.java:80)
      etc...
  </pre>
  
  <p>I think I may be able to fix it with a client.policy file, otherwise I might need to write an abstraction layer which uses a server-client network connection to query from the server-side...</p>
  
  <p>I'm sure the Java gurus here probably know the best way about it.</p>