First of all I am new to java. I would like to connect to a database
using the Class.forName method but I am having some difficulties
If the said method is set in the main form everything works as it
should but if I can't figure out how I can instansiated through a
class. I am receiving java.lang.ClassNotFoundException
I can confirm that the driver is correct as I managed to connect
through netbeans using the same driver details
The driver I am using is - com.mysql.jdbc.Driver and the
ConnectionUrl
is jdbc:mysql://localhost/<DatabaseName>
Any ideas?
Kind Regards
Jansen
You need to be sure that the JAR containing the driver is in the class
path when you compile or run:
http://java.sun.com/javase/6/docs/technotes/tools/solaris/classpath.html
http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html
As the MySQL driver JAR is known to NetBeans (Tools > Libraries), a copy
should appear in the dist/lib directory when you build your project.
--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>