[ale] MySQL and Java
Denny Chambers
dchambers at bugfixer.net
Wed Nov 12 20:58:39 EST 2003
jars in the $JAVA_HOME/jre/lib/ext, do not need to added to the
CLASSPATH. Java adds jars in the dir the CLASSPATH by default.
Here is some example code
/* Load database driver */
Class.forName("org.gjt.mm.mysql.Driver");
/* Create connection string. */
String url = new String("jdbc:mysql://servername/database-name");
// Open connection to database
Connection connection = DriverManager.getConnection(url, "user",
"password");
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("select * from foo");
Emil P. Man wrote:
> Hello ALErs,
>
> I am trying to access MySQL through some Java applets. I do not have
> any experience with writing applets for MySQL yet. So here is my
> issue. I have downloaded the JDBC driver from MySQL's web site, and
> tried installing it. I installed java in /usr/local/java and I have
> put the JDBC driver in /usr/local/java/jre/lib/ext/ where they
> recommend to put it. I have also changed my CLASSPATH to the full path
> to the file (including the .jar file). After compiling and running an
> applet, it is still complaining to me about MySQL JDBC Driver not
> being found. I use NetBeans IDE but I run the java program from the
> command line, (after NetBeans compiles it). I have also mounted the
> .jar file into the filesystems in NetBeans as an archive. I am still
> experiencing this problem.
> So guys, I am stumped. Can anybody help?
>
> Thanks in advance,
> Emil P. Man
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3435 bytes
Desc: S/MIME Cryptographic Signature
More information about the Ale
mailing list