• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class.forName() problem!!

 
ron mccarthy
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Please help me as soon as you can thanks,

Only if you post the stack trace the error generates.
 
ron mccarthy
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
    Posts: 1923
    Linux Postgres Database Scala
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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)
     
    Don't get me started about those stupid light bulbs.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic