views:

43

answers:

1

Hello Everyone,

I am try to connect to mysql database through a RCP project. I downloaded the Mysql Jconnect file. Extracted to a folder. Set the classpath variable as mentioned in the document. Still I am not able to connect to Mysql. I am getting this error

SQLException: No suitable driver found for jdbc:mysql://localhost:3306/test
SQLState: 08001
VendorError: 0

I then tried add mysql-connect jar file as external jar file in the project, still no luck. Tried adding it as a user library, nothing happened.

Finally I created a "plugin project from existing jar file" option and used the mysql-connect as the jar file. Then in my RCP project I added this plugin as dependancy plugin, yet same result.

I am absolutely sure of the code, the error is in the classpath. How do I resolve it.

My configs are :

OS: Ubuntu 10.04

Mysql version: 5.2.1

Eclipse : 3.5

I tried putting the file in /usr/bin directory, that didn't work either...

A: 

Not a complete answer, but this thread does mention:

After rechecking everything I found that mysql configuration on the second computer was not to listen for network connections, after fixing that, (almost) all started to work fine

P.S. but anyways, reading that there is no suitable driver it is hard to guess, that the driver is found but failed to connect :)

So maybe this is not a path or classpath issue, but a mysql configuration issue.


Actually the OP confirms in the comment that it was a classpath issue:

This thing finally worked. I copied the mysql-connect jar file into the project folder and added it to the runtime classpath of plugin.xml file.
The important thing here was I had to just enter the file name and not the absolute path.

VonC
I don't think so. MYsql is configs are ok.
Chaitannya
So figured it out, the problem was infact with the class path. This thing finally worked. I copied the mysql-connect jar file into the project folder and added it to the runtime classpath of plugin.xml file. The important thing here was I had to just enter the file name and not the absolute path :)
Chaitannya
@Chaitannya: great! I have included your specific step in my answer.
VonC