How to connect Java Eclipse to MySQL Server?

JDBC connectivity to MySQL Server


1.Download MySQL JDBC Driver from
2.  After downloading the zip file, extract it and add this .rar file to lib folder of eclipse project.
  learn how to add .rar file to the eclipse folder by following the steps(1-5) from this post.

3.Make a class file and paste the following code.
import java.sql.*;
//import the all valuable stuffs frm SQL
public class driver {
public static void main(String[] args) {
// TODO Auto-generated method stub
//Get connection
Connection con=DriverManager.getConnection(“jdbc:mysql://localhost:3306/new“,”root“,”root“);
// here , new is the name of database that i created from MySQL Workbench, first root is my username of sql server and second root is my password. 
// make statement
Statement st=con.createStatement();
//execute sql query
ResultSet rs=st.executeQuery(“select * from new_table”);
// new_table is the name of my table that i have created from the MySQL Server Workbench.
//process result set
// name is the column name of my table.
}catch( Exception exc){

How to find the similarity between two words in java using wordnet? 

1 thought on “How to connect Java Eclipse to MySQL Server?”

Leave a Comment


Enjoy this blog? Please spread the word :)