aspose file tools
The moose likes Applets and the fly likes Applets and MySQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Applets
Bookmark "Applets and MySQL " Watch "Applets and MySQL " New topic

Applets and MySQL

Dale Bradley

Joined: May 08, 2012
Posts: 6
Hi, im a new member here although i have been lurking for a few years!

I just realised that i originally posted in the wrong forum section, so sorry.

My problem:

I have created a java applet which is linked to a database in MySQL. It queries and updated the tables within depending on user interaction.
My applet runs fine from within Eclipse but i seem to be running into a similar problem to many others. I have looked over MANY threads on this problem but have yet to find a definitive answer/solution. They all seem to differ. I have picked up information from these threads but i am still a bit confused. When i open my applet through a html file nothing happens, no error messages, nothing. I have commented out my code and just painted a line of text and it works, so i dont believe its my html file thats the issue. What i would like to know from you gurus is:

1. Do i have to create a jar (i have tried this but is it necessary?)
2. Do i have to get my applet signed to enable the database interaction whilst running in a browser?
3. Could there be another reason why my applet will not load?

The GUI is displayed but nothing is pulled from my database.

This is extremely frustrating! It will eventually be placed on a server along with the database.

I can post the code if required, although it has quite a high amount of lines. Any help would be GREATLY appreciated!
Jayesh A Lalwani
Saloon Keeper

Joined: Jan 17, 2008
Posts: 2578

Open the Java console and look at the stack trace. It will tell you the core problem. Here's some info on how to enable the console

Dale Bradley

Joined: May 08, 2012
Posts: 6
Ah thanks a lot for that!

So, my error is that it cannot find the MySQL driver. I have added the jar to the jdk so im not sure what it could be. I will continue to look for a solution.

Thanks a lot for that tip, i was under the impression that the console in Chrome would supply me with that info, but clearly i was wrong!

Tim Moores

Joined: Sep 21, 2011
Posts: 2409
You need to add the driver jar to the applet tag's archive attribute, and distribute it with the applet. The easiest is probably in the same directory as the HTML file.
Pat Farrell

Joined: Aug 11, 2007
Posts: 4659

Dale, I have to ask my perennial question of folks posting here to the Applet forum: Why in the world are you using an Applet in 2012?

Applets were cool technology in 1997. They stopped being cool in 1998.

Modern solutions use the user's browser with some javascript talking to a web service (often written in Java using servlets).

What makes you want to try applets?
Walter Gabrielsen Iii
Ranch Hand

Joined: Apr 09, 2011
Posts: 158
Perhaps the Applet doesn't have the proper security permission to create a network connection to the database?
I agree. Here's the link:
subject: Applets and MySQL