Using MySql RDBMS with Java Applications -


To use MySql with Java Applications we need to know following required information -

1- Driver Name - The driver name for MySql is "com.mysql.jdbc.driver".
2- URL - The URL required to connect with MySql is "jdbc:mysql://localhost:3306/databaseName".
Here localhost is the host name, 3306 is the port number on which MySql RDBM run and databaseName is the name of database, you created.
3- UserName - The default user name for MySql is "root".
4- Password - It is the password entered by user at the time of instalation of MySql.
5- MySql Connector - TO connect Java Applications with MySql RDBMS you need to download MySql Connector jar file. You can download it from here -
    download mysql connector jar file

First of all create a database named Company in MySql. And within database create a table named Employee as follows -


Database - Company
Table - Employee

Employee
Eid Ename Salary
1 Rohit 1000000
2 Mohit 2000000
1- Open MySql Command Line and enter the password you entered at the time of instalation of MySql -


2- Create database named "Company" and use it -
mysql> create database company;
mysql> use company;


3- Create table named Employee and insert some records into it -
mysql> create table Employee(eid int, ename varchar(30), salary int);
mysql> insert into Employee values(1, 'Rohit', 1000000);
mysql> insert into Employee values(2, 'Mohit', 2000000);

You can use different IDE to create java applications and connect & execute queries with MySql RDBMS -

1- Using NetBeans IDE.
2- Using Eclipse IDE.