GeeCON Prague 2014*
The moose likes JDBC and the fly likes Class.forName() problem!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "Class.forName() problem!!" Watch "Class.forName() problem!!" New topic
Author

Class.forName() problem!!

ron mccarthy
Greenhorn

Joined: Apr 29, 2004
Posts: 17
Hello people,
I have this problem when i try to connect to the database, unfortunately at this line:

I have this embedded in a try and catch but every time it throws an error back at me. I am convinced that it cant find the Driver but it is beyond me as to why, because I have put it in my classpath and installed it many times.
Please help me as soon as you can thanks,
Neil.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


Please help me as soon as you can thanks,

Only if you post the stack trace the error generates.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
ron mccarthy
Greenhorn

Joined: Apr 29, 2004
Posts: 17
Here it is:



  • java.lang.ClassNotFoundException: com.mysql.jdbc.Driverat java.net.URLClassLoader$1.run(URLClassLoader.java:199)
  • at java.security.AccessController.doPrivileged(Native Method)at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
  • at java.lang.ClassLoader.loadClass(ClassLoader.java:289)at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
  • at java.lang.ClassLoader.loadClass(ClassLoader.java:235)at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
  • at java.lang.Class.forName0(Native Method)at java.lang.Class.forName(Class.java:141)
  • at scms.Database.connect(Database.java:22)at scms.Database.queryDatabase(Database.java:48)
  • at scms.logIn$ActionHandler.actionPerformed(logIn.java:94)at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
  • at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
  • at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
  • at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)at java.awt.Component.processMouseEvent(Component.java:5100)
  • at java.awt.Component.processEvent(Component.java:4897)at java.awt.Container.processEvent(Container.java:1569)
  • at java.awt.Component.dispatchEventImpl(Component.java:3615)at java.awt.Container.dispatchEventImpl(Container.java:1627)
  • at java.awt.Component.dispatchEvent(Component.java:3477)at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
  • at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
  • at java.awt.Container.dispatchEventImpl(Container.java:1613)at java.awt.Window.dispatchEventImpl(Window.java:1606)
  • at java.awt.Component.dispatchEvent(Component.java:3477)at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
  • at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)at
  • java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)Driver not found on connection attempt


  • [ May 28, 2004: Message edited by: ron mccarthy ]
    Stefan Wagner
    Ranch Hand

    Joined: Jun 02, 2003
    Posts: 1923

    but it looks very much as a classpath-issue...

    Location of the Driver?
    Command to start the Application?
    echo $CLASSPATH (linux) echo %CLASSPATH% (win)
    echo $JAVA_HOME (linux) echo %JAVA_HOME% (win)


    http://home.arcor.de/hirnstrom/bewerbung
     
    GeeCON Prague 2014
     
    subject: Class.forName() problem!!