Sign in to follow this  
styrpe

[java] applet + mysql

Recommended Posts

I'm trying to make an applet that can connect with mysql.I'm using the jdbc driver and it works fine,when running it in an application.When I tried running it with an applet in a html page,it won't connect.The error is "no suitable driver".I know it has to do with the driver I downloaded.I'm new with applets and don't know what to do.Is it possible to do this in an html applet?? Thanks for any help.

Share this post


Link to post
Share on other sites
You definitely do not want to do this. It would take so many things to just get it working that you will never get a user to use the applet.

However, if this is just for personal use, I can give you a couple of suggestions. The JDBC driver files must be in the classpath that the applet has access to. The easiest way to do this is to put your applet in an archive file and include the driver files in the same archive. You will also need to sign your applet and ask for permission to make a network connection.

Share this post


Link to post
Share on other sites
Unless that network connection is made to the server where the user just loaded the applet from, in that case you are allowed to make a connection. You should look up applet restrictions on sun's site, that will give you a fairly good idea of the possibilities and limitations.

Share this post


Link to post
Share on other sites
It should work, provided the MySQL is on the same server hostname as the applet was loaded from.

Ensure that the MySQL JDBC driver is either added to the applet's jar, or in its classpath.

It's a very bad idea to make secure applications this way, because the user could easily reverse engineer the applet and obtain direct access to the database, getting any privileges the applet had on the DB.

Mark

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this