We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3
1.
Set Up MySQL Table:
CREATE DATABASE IF NOT EXISTS EmployeeDB;
USE EmployeeDB;
CREATE TABLE IF NOT EXISTS Employee (
Name VARCHAR(50), ID INT PRIMARY KEY, Designation VARCHAR(50), Department VARCHAR(50), Salary DECIMAL(10, 2), Income DECIMAL(10, 2) ); 2. Java Code to Insert Values into Employee Table: import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException;
public class EmployeeDBExample {
// JDBC URL, username, and password for MySQL
static final String JDBC_URL = "jdbc:mysql://localhost:3306/EmployeeDB"; static final String USER = "root"; // Update to your MySQL username static final String PASSWORD = "password"; // Update to your MySQL password