- MySQL
- IDE(e.g., IntelliJ IDEA, Visual Studio Code)
Step 1: Create Database name BankApp
-- Create a new database called 'BankApp'
CREATE DATABASE BankApp;
-- Switch to the newly created database
USE BankApp;
Step 2: Create Table name customer
--Create table
CREATE TABLE `customer` (
ac_no int NOT NULL AUTO_INCREMENT,
cname varchar(45) DEFAULT NULL,
balance varchar(45) DEFAULT NULL,
pass_code int DEFAULT NULL,
PRIMARY KEY (ac_no),
UNIQUE KEY cname_UNIQUE (cname)
) ;
Create New Project
Create A package name BankManagement
& BankManagement/Connection
Create a Connection
class in the BankManagement/Connection
package
Create a bankManagement
class in the BankManagement
package
// register jdbc Driver
String mysqlJDBCDriver = "com.mysql.cj.jdbc.Driver";
Class.forName(mysqlJDBCDriver);
// Create Connection
String url = "jdbc:mysql://localhost:3306/databaseName";
String user = "root";
String pass = "123";
con = DriverManager.getConnection(url, user, pass);