-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John R Langan wrote:

> Hi All,
> I hope someone can help with this connection problem.
[snip]
> When attempting to connect from the PC on the intranet the trace gives
> the following:
>
> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver    at
> sun.applet.AppletClassLoader.findClass(Unknown Source)    at
> sun.plugin.security.PluginClassLoader.findClass(Unknown
> Source)    at java.lang.ClassLoader.loadClass(Unknown Source)    at
> sun.applet.AppletClassLoader.loadClass(Unknown Source)    at
> java.lang.ClassLoader.loadClass(Unknown Source)    at
> java.lang.ClassLoader.loadClassInternal(Unknown Source)    at
> java.lang.Class.forName0(Native Method)    at
> java.lang.Class.forName(Unknown Source)    at
> Database.connect(Database.java:666)    at
> Database.testExists(Database.java:305)
> <snip>

How is your applet deployed? The driver classes have to be in the same
CODEBASE as your applet, otherwise the JVM won't be able to load them.

> Attempting to connect over the internet the trace gives:
>
> java.sql.SQLException: Unable to connect to any hosts due to exception:
> java.security.AccessControlException: access denied
> (java.net.SocketPermission 192.168.1.90:3306 connect,resolve)    at
> com.mysql.jdbc.Connection.createNewIO(Connection.java:1592)    at
> com.mysql.jdbc.Connection.<init>(Connection.java:486)    at
> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:326)
> at java.sql.DriverManager.getConnection(Unknown Source)    at
> java.sql.DriverManager.getConnection(Unknown Source)    at
> Database.connect(Database.java:667)
> <snip>

Check the security model documentation for applets. Applets aren't
allowed to make network connections to anything but the host that served
up the .class files. If your MySQL server is not the _same_ host, then
you won't be able to connect unless you digitally sign your applets and
your end-users allow the applet to make network connections to
'arbitrary' hosts. If you don't want to do this, you will either need to
run your MySQL server on your webserver, or install some kind of port
redirector to re-direct port 3306 on your webserver to your MySQL
server. However, I _don't_ recommend having applets talk _directly_ to
MySQL, it is more flexible and secure to have applets speak something
like HTTP to a middleware server that then 'talks' to MySQL.

        -Mark


- --
For technical support contracts, visit https://order.mysql.com/?ref=mmma

    __  ___     ___ ____  __
   /  |/  /_ __/ __/ __ \/ /  Mark Matthews <[EMAIL PROTECTED]>
  / /|_/ / // /\ \/ /_/ / /__ MySQL AB, SW Dev. Manager - J2EE/Windows
 /_/  /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
        <___/ www.mysql.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+8IZBtvXNTca6JD8RAi4fAJ9xi+5tXjFX+xdwdyNnTEb4I+BkRACgodAt
xNCVFTNMVfXXzkKKzcc9BDI=
=ilb6
-----END PGP SIGNATURE-----


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to