I suggest you should try connecting to MariaDB using some client like DBVisualiser etc and same username and password. This confirms that DB is running and open for connection and credentials are correct. Once connected to DB make sure that you test database exists . If you can verify all of these to be ok then the problem is with the code.
I looked at you code and confused with the method named getEnlace(). I don't know what it is returning ? .
Class.forName(getEnlace()).newInstance();
should't it be like
Class.forName(getControlador()).newInstance();
assuming getControlador returns the name of the jdbc driver class.