Reputation: 4150
Hi Guys I have This Applet that Displays with the Error as I have Posted Below. The Screen Shot of my build folder also is there Where Do I place the mysql-connector-java-5.1.13-bin.jar file so that It can connect with My Applet from a Web Browser???
The Applet Runs well When I run it manually as the Mysql Jar is in the Class path.
Here is My Build Directory:
My Login.html File looks like this :
<HTML>
<HEAD>
<TITLE>MY Applet</TITLE>
</HEAD>
<BODY>
<H3><HR WIDTH="100%">My Applet<HR WIDTH="100%"></H3>
<P>
<APPLET codebase="classes" code="Login.class" width=350 height=200></APPLET>
</P>
<HR WIDTH="100%"><FONT SIZE=-1><I>Generated by NetBeans IDE</I></FONT>
</BODY>
</HTML>
Upvotes: 1
Views: 1326
Reputation: 168835
It the applet element is:
<APPLET
codebase="classes"
code="Login"
archive="mysql-connector-java-5.1.13-bin.jar"
width=350
height=200>
</APPLET>
The archive would need to be located at:
classes/mysql-connector-java-5.1.13-bin.jar
But Alex is right about the part that an applet should not have direct access to the DB. The DB should be placed behind an interface (e.g. a web-app.) that hides the details of the server, authenticates users, and regulates user activity.
Upvotes: 1
Reputation: 115368
You should never implement applet that uses database directly. Applet by definition runs in browser and should talk to server via HTTP only. You should implement server side component that exposes Web service API (soap, rest, whatever). The server side component should work with DB while applet should work with the API exposed by this component.
EDIT. You can however add mysql driver to the applet classpath. It will probably work for you while both DB and browser are running on the same machine but will fail for regular user that is typically behind firewall.
Upvotes: 0