Hello everybody,
I trying to develop an API REST EXtension that connects to an Mysql database. I loaded all the dependencies (mysql driver included) in the rest extension pom.xml and build/deploy the package. But, when i tried to call the rest method i developed from chrome, i receive the following error in the log:
No suitable driver found for jdbc:mysql://localhost:3306/baseexample
clearly, the mysql driver was not loaded, but i cannot find a way to load the driver from the source. This is my connection method:
`package com.conexion
import java.sql.Connection
import java.sql.DriverManager
import java.sql.SQLException
import org.slf4j.Logger
import org.slf4j.LoggerFactory
class Conexion {
private static final Logger LOGGER = LoggerFactory.getLogger(Conexion.class);
private Connection con;
public Connection getCon() {
return con;
}
public void conectar(){
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/baseexample","root", "");
if(con!=null) {
LOGGER.info("######################### Conexion satisfactoria ############################");
}
}
catch (SQLException e) {
LOGGER.info("######################### Error en la conexion: "+e.getMessage()+" #########################");
}
}
}`