Here is a little insight, I have reinstalled VS Code and its extensions, used this code without any extensions, and the error remains the same.
I also added the jar file in referenced libraries and refreshed it, but the code doesn't work.
I tried importing com.mysql.jdbc.Driver and com.mysql.cj.jdbc.Driver, tried changing com.mysql.jdbc.Driver to com.mysql.cj.jdbc.Driver.
This code works in eclipse IDE, but I would rather not switch my entire operation to eclipse.
import java.sql.*;
public class newapp2jdbc {
public static void main(String[] args) throws Exception {
String url = "jdbc:mysql://localhost:3306/sql_workbench";
String uname = "root";
String pass = "0768";
String query = "select name from student where id=3";
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(url, uname, pass);
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(query);
rs.next();
String name = rs.getString(1);
System.out.println(name);
st.close();
con.close();
}
}





