How can we want to connect mysql version 5.1 using java?

i want to connect to mysql 5.1 using java then i got problem of error:com.mysql.jdbc.driver

i have use mysql-connector-java-5.1.13-bin.jar by putting it in mysql inside bin directory but running java program from command promt didn't connect

Looking your answer

Upvotes: 0

Views: 304

Answers (1)

bakkal
bakkal

Reputation: 55448

The libraries have to be in your Java's classpath not in MySQL's bin directory.

You can try calling it with:

java -cp /path/to/mysql-connector-java-5.1.13-bin.jar myPackage.MyProgram

I suggest you group your JAR dependencies under an adjacent lib folder and set that as your classpath. Will keep libraries in one place and make it easier to distribute and run the software.

Upvotes: 5

Related Questions