2

I have installed Eclipse Luna recently to do programming on JSP. Currently i'm trying to connect it with JDBC. I have downloaded mysql J connector and added mysql-connector-java-5.1.31-bin.jar to the build path. I've trying running in on my browser and i get the following error:

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

I'm pretty sure that my settings are correct in terms of setting the path. I also have set up the CLASSPATH in environment variables just in case that is the main problem, but still i'm facing the same problem.

Can anyone help me?

A4L
  • 17,353
  • 6
  • 49
  • 70
Ben
  • 29
  • 1
  • 1
  • 2

2 Answers2

7

U need to add jar file to build path

right click on project->build path->configure build path->libraries tab ->add external jar

browse it and add it.

after adding also if u not getting same error, then

You must include the jar file in the Deployment Assembly of the Project.......

1)select the web project which contains the jsp file...

 2)select Project tab in the menubar in Eclipse

3)select properties in the drop down menu

4)select Deployment Assembly

5)Add your ojdbc6.jar file in it..

Hope this will help u..

Madhavi Talla
  • 205
  • 2
  • 5
  • 12
1

Yes your settings are right for building the application, running it needs other settings. You need to place the jar file either in CATALINA_HOME/lib or in <your-app>/WEB-INF/lib so that the driver is found at run time. The latter is preferable.

A4L
  • 17,353
  • 6
  • 49
  • 70