Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the MySQL JDBC jar file in Ubuntu?

I have installed MySQL 5.5.32 via apt-get install into Ubuntu 13.04.I want to use it in a Java project.For this i must have MySql connector jar.I can not find it.I tried locate *mysql*.jar but it did not find anything.I looked into /etc/mysql but there is no jar in it.I don't want to download it from internet because i believe that it somehow exists in an MySQL folder.Does anybody have any idea where the connector jar went into Ubuntu 13.04?

like image 914
ihsan kocak Avatar asked Aug 08 '13 14:08

ihsan kocak


People also ask

Where is the MySQL JDBC driver jar?

jar' is stored in "C:\Program Files\MySQL\MySQL Connector J\". Note : The class path is the path that the Java Runtime Environment (JRE) searches for classes and other resource files.

Where do I put JDBC jar?

Copy the JDBC . jar file you downloaded to the system-wide Java Extensions folder (C:\Windows\Sun\Java). Add the directory containing the JDBC . jar file to the CLASSPATH environment variable (see Modifying the Java CLASSPATH).

Where is JDBC in Linux?

The JDBC driver is typically located at the location WL_HOME/server/lib of the installation directory. The file is ojdbc7. jar or ojdbc6. jar (for new versions of WLS), or ojdbc14.


2 Answers

If you're using a version of Ubuntu prior to 19.04, you'll need to install libmysql-java, the MySQL JDBC driver, because the connector is not in the Ubuntu-packaged MySQL package that you've already installed. Versions after that do not publish that package.

Once it's installed, you'll have the file /usr/share/java/mysql.jar, which is an indirect symlink to the actual jar file.

Alternatively, install the mysql-apt-config package, update, and you'll be able to install all currently supported MySQL software with apt.

like image 92
Jeremy Smyth Avatar answered Sep 25 '22 15:09

Jeremy Smyth


First, apt-get install libmysql-java

Then mysql.jar is located in /usr/share/java/mysql.jar.

Third, in Eclipse, do this as: Project -> Properties -> Java Build Path -> Libraries -> Add External JARs -> select /usr/share/java/mysql.jar

like image 23
wangzhengyi Avatar answered Sep 25 '22 15:09

wangzhengyi