Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with Applet ? JDBC ? Tomcat ? MySql 1

Status
Not open for further replies.

prmckee

Programmer
Jul 27, 2004
8
0
0
IE
I am having problems accessing a MySql database from an applet running in internet Explorer 4/5 using JDBC. The applet is served by tomcat.

When the html (JSP) page loads the applet appears but does not have a connection back to the MySql database (the widgets are not filled with the information retrieved from MySql). When you look at the Java Console I see the following error:

Class not found Exception: com.mysql.jdbc.Driver

It should be noted here, that the applet works fine when run from NetBeans using an applet viewer. (I presume that this is because locally run applet has access to the server local machine class path)

Have tried placing the mysql-connector-java-3.0.14-production-bin.jar in the \Tomcat\common\lib folder, and in the \Tomcat\webapps\oplog\META-INF\lib (oplog is the name of the project), and \Tomcat\shared\lib, and everywhere else that I have found recommended on news groups across the net, but to no avail. I get the same error in the sun Java console every time.

Using System:
NetBeans IDE 3.6
Apache Tomcat/4.1.29
JVM Version 1.4.2_04-b05
OS Name Windows 2000 (5.0)
OS Architecture x86
JDBC mysql-connector-java-3.0.14-production-bin.jar (com.mysql.jdbc.Driver)

Any help would be greatly appreciated as I seem to be stuck on this forever!
Regards
 
You have to remember that applets run off the client machine - so they use libraries on the client, not on the server. So if the client machine does not have the relevant jar file in their JRE_HOME/lib/ext directory, then its not going to work.

However, you can get around this by telling the client browser to load libraries from your server, like this :

<applet archive="mysql.jar,myjar.jar" ...>
</applet>

You shoud put the mysql-connector....bla.jar in the direcory where your applet code (.class) is served from, or in a directory reletive to the codebase, with the path suitably altered in the applet tag's archive attribute.

EG :

<applet archive="client_libs/mysql.jar,client_libs/myjar.jar" ...>
</applet>

--------------------------------------------------
Free Database Connection Pooling Software
 
In the future, please do not cross-post questions in multiple forums, as it is frustrating for those of us that answer questions across many forums.

Thanks.

I have answered your query in the tomcat thread posting.

multiple posts :

java forum : thread269-888202
tomcat forum : thread877-888196
mysql forum : thread436-888201

--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top