How do I install com.mysql.jdbc.Driver for Fedora17 O.S using jdk version 1.7 I always get an error of could not find Driver with class name:com.mysql.jdbc.Driver in all my jdbc codes.
Asked
Active
Viewed 9,380 times
0
-
@Pshemo sir please help me out with this if possible – user3874048 Mar 19 '15 at 06:12
-
possible duplicate of [Java connectivity with MySQL](http://stackoverflow.com/questions/2839321/java-connectivity-with-mysql) – Mark Rotteveel Mar 19 '15 at 20:55
1 Answers
-1
Assuming that you already have MySQL installed,
Install the connector driver. :
yum install libmysql-java
Then make sure that the classpath is set.
export CLASSPATH=$CLASSPATH:/usr/share/java/mysql-connector-java.jar
If you want to set this for all users, you should modify the
/etc/environment
instead
If you are using Eclipse, you can also do this by going through the following steps:
- Select
Project Properties > Java Build Path
- Select Libries tab
- Click Add External Jars
- Choose the jar file, in this case
mysql-connector-java.jar

Community
- 1
- 1

sudheesh shetty
- 358
- 4
- 14
-
Is classpath setting to be done by using this:: CLASSPATH=$CLASSPATH:/usr/share/java/mysql-connector-java.jar – user3874048 Mar 19 '15 at 07:15
-
Refer this http://docs.oracle.com/javase/tutorial/essential/environment/paths.html – sudheesh shetty Mar 19 '15 at 08:42
-
export CLASSPATH=$CLASSPATH:/usr/share/java/mysql-connector-java.jar this is actually a one liner where you set the CLASSPATH and export it – sudheesh shetty Mar 19 '15 at 08:43
-
May be even this will help you http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/classpath.html – sudheesh shetty Mar 19 '15 at 08:44
-
this has to be done on the terminal ryt??export CLASSPATH=$CLASSPATH:/usr/share/java/mysql-connector-java.jar – user3874048 Mar 19 '15 at 09:05
-
try doing sudo yum install libmysql-java and ya this has to be done in terminal – sudheesh shetty Mar 19 '15 at 09:46
-
No sudheesh dis ain't workin either.Am geting error:: This is not in the sudoers file. This incident will be reported. – user3874048 Mar 19 '15 at 09:51
-
Download my-sql-conneector from here. Since you are working in fedora go fro tar.gz one http://dev.mysql.com/downloads/connector/j/3.1.html extract it and set classpath by changing the path in the above mentioned command eg:export CLASSPATH=$CLASSPATH:
– sudheesh shetty Mar 19 '15 at 10:34 -
The classpath environment is almost never used, except for the simplest of application (and not when you for example use an IDE). – Mark Rotteveel Mar 19 '15 at 20:56
-