import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
import com.mchange.v2.c3p0.ComboPooledDataSource;
public class ConnectionFactory {
public DataSource dataSource;
public ConnectionFactory() {
ComboPooledDataSource comboPooledDataSource = new ComboPooledDataSource();
comboPooledDataSource.setJdbcUrl("jdbc:mysql://localhost/loja_virtual?useTimeZone=true&serverTimeZone=UTC");
comboPooledDataSource.setUser("root");
comboPooledDataSource.setPassword("dani1804");
comboPooledDataSource.setMaxPoolSize(15);
this.dataSource = comboPooledDataSource; -->>> linha que dá o erro
}
public Connection recuperarConexao() throws SQLException {
return this.dataSource.getConnection();
}
}
Na linha this.dataSource = comboPooledDataSource; do ConnectionFatory, mesmo adicionando os 2 jars do site, está aparecendo o erro Type mismatch: cannot convert from ComboPooledDataSource to DataSource não deixando converter de ComboPooledDataSource para DataSource.