> Hoping for help. I successfully installed MySQL 3.22 and JDK1.1.8 and
> mm.mysql.1.2b on FreeBSD
> 2.2.8. I was able to create a database and using the mm.mysql driver in a java
> application retrieve
> from the database. I did have to set my
> CLASSPATH=/usr/loca/mm.mysql-1.2b/mysql_comp.jar but it
> did work. Now from an applet point of view, it does not have the CLASSPATH and hence
> properly complete the Class.forName("org.gjt.mm.mysql.Driver").newInstance and hence
> fails at this
> point. I've tried including the location via imports as follows:
> import org.gjt.mm.mysql.*;
> import org.gjt.mm.mysql.Connection;
> import org.gjt.mm.mysql.Statement;
> import org.gjt.mm.mysql.Driver;
> import org.gjt.mm.mysql.ResultSet;
> but this causes compiler errors such as:
> Load2.java:40: Incompatible type for declaration. Explicit cast needed to conver
> t java.sql.Connection to org.gjt.mm.mysql.Connection.
> Connection con = DriverManager.getConnection(url, "webuser", "");
Reasons to not import the org.gjt.mm.mysql classes are:
- It makes your code nonportable. The java.sql classes and interfaces
work with any JDBC driver, the org.gjt.mm classes are specific to one
- With a few exceptions, the org.gjt.mm classes are not intended to be
used directly. The author cannot necessarily promise that they will
behave a certain way, or behave the same in the future, except that they
will continue to implement the JDBC interfaces properly.
> as the documentation states one should not directly import these, is this the reason
The reason your code doesn't work is a different one.
> So finally, I was wondering either where I should place the jar file and/or how to
> get the applet to
> find it. I'm still learning how Java packages and directing works so please, specific
> examples are
> worth a hundred words. Thank you so much for any and all help.
A standard way to deal with your situation is to unpack the JAR file
into a directory area, e.g.
$ jar -xf /usr/local/mm.mysql-1.2b/mysql_comp.jar
Put your own files in the same directory area. Applets have the CODEBASE
property instead of CLASSPATH, but you can't rely on having more than
one item in CODEBASE.
<applet code=my.MainClass codebase="/classesdir" etc. >
You can test this setup by running your *application* with a CLASSPATH
that has only one item in it: this directory.
Then the applet version should work.
Impact Online, Inc.
|• mm.MySQL - Newbie||Geocrawler.com||17 Jul|
| • Re: mm.MySQL - Newbie||Cris Perdue||17 Jul|