• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Getting exception while loading

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Iam using MySql and while using eclipse and tried to load driver with the statement,

Class.forName("com.mysql.jdbc.Driver").newInstance();
iam getting the exception
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

i transferred my code to Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
but again iam getting exception as
caughtjava.lang.ClassNotFoundException: com.mysql.jdbc.Driver

When i use the second code in notepad it is working.Could anybody help me.

Thanks in advance
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to make sure the driver is in your classpath. Where have you put the MySQL driver jar file?
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not able to find the class / jar containing the class in the classpath.Look into the scope of the classloader , which is trying to load the class.If its within a webapplication then put the jar in application/WEB-INF/lib folder.
 
reply
    Bookmark Topic Watch Topic
  • New Topic