Load Mysql-connector in eclipse

Hi,

i am trying to create a Vaadin Application.
I want to user Mysql with the with SimpleJDBCConnectionPool.

I got this code from the Tutorial:

connectionPool = new SimpleJDBCConnectionPool(	"com.mysql.jdbc.Driver", 
															"jdbc:mysql://192.168.254.100:3306/addressbook", 
															"root", 
															"123abcABC");

The Problem is, that i got this error:

SEVERE: Servlet.service() for servlet [Addressbook Application]
 in context with path 
[/AddressBook] threw exception [java.lang.RuntimeException: Specified JDBC Driver: com.mysql.jdbc.Driver - initialization failed.]
 with root cause
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

I found some threads with the problem and they all fixed it, by adding the mysql-connector to the project. But i tried and i didnt get it to work in eclipse.
I copied the jar (downloaded from mysql) to my projectfolder in new folder libs.
Then i added the Jar like this: Rightclick on Project → Properties → Java Build Path → Libaries → Add Jar and then i got the “Folder” Addressbook/libs/mysql-connector-java5.1.2.4-bin.jar.

But the problem still persists.

How do i add the jar correctly to eclipse project ?

Thanx for helping me.

greetings xasz

Hi Michael,

copy the driver mysql-connector-java5.1.2.4-bin.jar also into the directory

WebContent/WEB-INF/lib

Norbert

Thank you Norbert!

That did the trick :slight_smile:

I was quite sure its just a little fail.