Basically everything's connected and database works properly except for the fact that I'm unable to print anything out of it into the console. And I dunno how 2 fix this very problem. Help me out pls
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.*;
class Main{
private static final String url = "jdbc:mysql://localhost:3306/";
private static final String user = "root";
private static final String password = "12345678";
public static void main(String args[]){
try {
Class.forName("com.mysql.jdbc.Driver");//it goes to catch immediately after this line
Connection con = DriverManager.getConnection(url, user, password);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from emp");
while (rs.next()) {
int price = rs.getInt(3);
System.out.println(price);
}
con.close();
}
catch (Exception e) {
System.out.println(e);
}
}
}
That what it prints in the end of execution:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver