File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Connect to MySQL from Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Connect to MySQL from Applet" Watch "Connect to MySQL from Applet" New topic

Connect to MySQL from Applet

Smilidon Sapiens
Ranch Hand

Joined: Nov 02, 2000
Posts: 66
I try to connect to a mySql database, but I always get this message: Cannot connect to MySql server...(
I don't want to make a certification, the applet is for an intranet. Is there any other way?
If not, how can I certificat my applet?
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
If you don't want to bother with certification, your applet is only allowed to communicate back with the host it was loaded from. So you have two choices:
1. put the database on the same machine as the web server
2. run a "port redirector" on the web server machine which redirects traffic on a specified port to a different port on another machine. This way your applet thinks the database is on the web server machine, but it's actually somewhere else.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Smilidon Sapiens
Ranch Hand

Joined: Nov 02, 2000
Posts: 66
Ok, MySQL is on the webserver. Now, I have to load an image from an other server. This is the same problem right? Where can I get a "port redirector"?
Please help...
I agree. Here's the link:
subject: Connect to MySQL from Applet
It's not a secret anymore!