Pessoal. Blz?
Estou recebendo o erro "Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc: mysql:/localhost:3306/loja_virtual/" no meu projeto.
O mysql-connector-java-8.0.17 esta na pasta WEB-INF/lib
no ClassPath tbm esta colocado
insira seu código aqui
public class TesteConexao {
public static void main(String[] args) throws SQLException, ClassNotFoundException {
// TODO Auto-generated method stub
Connection con = null;
String hostName = null;
String userName = null;
String password = null;
String url = null;
String jdbcDriver = null;
String dataBaseName = null;
String dataBasePrefix = null;
String dabaBasePort = null;
hostName = "localhost";
userName = "root";
password = "root@1234";
jdbcDriver = "com.mysql.cj.jdbc.Driver";
dataBaseName = "loja_virtual";
dataBasePrefix = "jdbc: mysql:/";
dabaBasePort = "3306";
url = dataBasePrefix + hostName + ":"+dabaBasePort+"/" + dataBaseName + "/";
Class.forName(jdbcDriver);
con = DriverManager.
getConnection(url, userName, password);
con.close();
}
}