Class.forName("com.mysql.cj.jdbc.Driver"); String url="jdbc:mysql://localhost:3306/your_database_name"; String name="your_username"; String password="your_password"; Connection c=DriverManager.getConnection(url,name,password);