package jdbc1;
import java.sql.*;
public class sauravzure {
public static void main(String[] args) throws ClassNotFoundException {
try {
// Replace with your database URL, username, and password
String url = "jdbc:mysql://localhost:3306/your_database";
String username = "your_username";
String password = "your_password";
// Load the JDBC driver
Class.forName("com.mysql.cj.jdbc.Driver");
// Establish a connection to the database
Connection connection =
DriverManager.getConnection("jdbc:mysql://localhost:3306/pandurang","root","root3112");
// Create a statement object
Statement statement = connection.createStatement();
// Create the table
String sql = "CREATE TABLE employees (" +
"emp_id INT PRIMARY KEY," +
"emp_name VARCHAR(50) NOT NULL" +
")";
statement.executeUpdate(sql);
System.out.println("Table created successfully!");
// Close the connection
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();