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 Applet to MySQL DB connection Success!!!! 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 "Applet to MySQL DB connection Success!!!!" Watch "Applet to MySQL DB connection Success!!!!" New topic

Applet to MySQL DB connection Success!!!!

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

Ok, I have been trying to get this to work for about a week now and I finally did it!! So, for all those struggling with it, here is a complete instruction set on what I did.
System Specs
Server - Windows 2000 Advanced Server running as Web Server
Database - MySQL Max 4.0
MySQL Driver - mm.mysql.jdbc-1.2c
JDK 1.3.1_02
Java Editor - JCreator Pro 2.0
I had to set the CLASSPATH inside my editor and point it to the MySQL Driver. I had initially set the CLASSPATH in my Environment Variables, however, my editor was over-riding those.
JAR instructions
For testing purposes here were my files:


JAR Command Line
JAR cvf test1.jar classes\*.*
As you can see in my HTML file, I then point the archive PARAM to my test1.jar as well as my mySQL_uncomp.jar. This way, the applet knows where all the code is.
Misc Hints
I did not use any certification or trust policies, nor did I jarsign my JAR files. The reason I didn't have to is because the only file system I am accessing is the same one the Applet originates from, the Web Server. However, if you wish to manipulate anything on the client machine, you must authenticate your applet to the browser and make it a trusted applet.
I hope that this helps some people having the same problem I was having. If anyone has any question about what I did, please feel free to contact me.
Thanks for everyones help in me resolving this issue.

GenRocket - Experts at Building Test Data
Suzana Shah

Joined: Jan 07, 2002
Posts: 12
Hi Greg
Say if I had the following system specs:
Server - Tomcat server but on win98 platform
Database - MySQL 3.23.44-max
MySQL Driver - mm.mysql.jdbc-1.2c
JDK 1.3
Java Editor - JCreator Pro 2.0
Then in the above case, would i have to change the code, or shall i try using what you have done, would there be any changes to it?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

I am not that familiar with the Tomcat Web Server, but I don't think you would have to change anything. Everything else is the same. There may be some Security differences in the Web Server that may have to be adjusted, but that's all I can tell.
I agree. Here's the link:
subject: Applet to MySQL DB connection Success!!!!
It's not a secret anymore!