MYSQL No suitable driver found










0














I currently use Intellij, it turns out that I am trying to connect to a MySQL database, but after adding the library and using a connection class which works perfectly with the MariaDB driver, I find the error in the question title



public void conectar() 
try
conexion = DriverManager.getConnection(url, usuario, contraseña);
if (conexion != null) JOptionPane.showMessageDialog(null, "Conexión establecida a : n" + url, "ACDA2", JOptionPane.INFORMATION_MESSAGE);
Class.forName("com.mysql.jdbc.Driver");
stm = conexion.createStatement();//crea un objeto que permite enviar instrucciones a la base de datos

catch (SQLException ex)
JOptionPane.showMessageDialog(null, "Conexión fallida a : n " + url, "", JOptionPane.ERROR_MESSAGE);
System.out.println(ex.getMessage());
catch (ClassNotFoundException e)
JOptionPane.showMessageDialog(null, "Error al cargar el driver", "", JOptionPane.ERROR_MESSAGE);
System.out.println(e.getMessage());




enter image description here



enter image description here



These are the values ​​that I send to my class connection



c= new conexion("jdbc:mysql://", "127.0.0.1/", "root", "", "sanciones");
c.conectar();



And then I detail the connection class constructor



 public conexion(String driver,String host, String usuario, String 
contraseña, String baseDatos)
this.usuario = usuario;
this.contraseña = contraseña;
this.baseDatos = baseDatos;
this.driver = driver;
this.host = host;
this.url = driver + this.host + this.baseDatos;



UPGRADE



The driver versions com.mysql.jdbc_5.1.5 do not allow the implicit loading of the driver due to the lack of the Services subfolder in META-INF and its corresponding content, even if it is JDBC4 and in the mysql manuals it is said that it is possible, it is not, at least with this specific version, greetings










share|improve this question























  • My guess is that the MySQL/MariaDB driver JAR is not on your classpath, and is therefore not available at runtime.
    – Tim Biegeleisen
    Nov 10 '18 at 13:18















0














I currently use Intellij, it turns out that I am trying to connect to a MySQL database, but after adding the library and using a connection class which works perfectly with the MariaDB driver, I find the error in the question title



public void conectar() 
try
conexion = DriverManager.getConnection(url, usuario, contraseña);
if (conexion != null) JOptionPane.showMessageDialog(null, "Conexión establecida a : n" + url, "ACDA2", JOptionPane.INFORMATION_MESSAGE);
Class.forName("com.mysql.jdbc.Driver");
stm = conexion.createStatement();//crea un objeto que permite enviar instrucciones a la base de datos

catch (SQLException ex)
JOptionPane.showMessageDialog(null, "Conexión fallida a : n " + url, "", JOptionPane.ERROR_MESSAGE);
System.out.println(ex.getMessage());
catch (ClassNotFoundException e)
JOptionPane.showMessageDialog(null, "Error al cargar el driver", "", JOptionPane.ERROR_MESSAGE);
System.out.println(e.getMessage());




enter image description here



enter image description here



These are the values ​​that I send to my class connection



c= new conexion("jdbc:mysql://", "127.0.0.1/", "root", "", "sanciones");
c.conectar();



And then I detail the connection class constructor



 public conexion(String driver,String host, String usuario, String 
contraseña, String baseDatos)
this.usuario = usuario;
this.contraseña = contraseña;
this.baseDatos = baseDatos;
this.driver = driver;
this.host = host;
this.url = driver + this.host + this.baseDatos;



UPGRADE



The driver versions com.mysql.jdbc_5.1.5 do not allow the implicit loading of the driver due to the lack of the Services subfolder in META-INF and its corresponding content, even if it is JDBC4 and in the mysql manuals it is said that it is possible, it is not, at least with this specific version, greetings










share|improve this question























  • My guess is that the MySQL/MariaDB driver JAR is not on your classpath, and is therefore not available at runtime.
    – Tim Biegeleisen
    Nov 10 '18 at 13:18













0












0








0







I currently use Intellij, it turns out that I am trying to connect to a MySQL database, but after adding the library and using a connection class which works perfectly with the MariaDB driver, I find the error in the question title



public void conectar() 
try
conexion = DriverManager.getConnection(url, usuario, contraseña);
if (conexion != null) JOptionPane.showMessageDialog(null, "Conexión establecida a : n" + url, "ACDA2", JOptionPane.INFORMATION_MESSAGE);
Class.forName("com.mysql.jdbc.Driver");
stm = conexion.createStatement();//crea un objeto que permite enviar instrucciones a la base de datos

catch (SQLException ex)
JOptionPane.showMessageDialog(null, "Conexión fallida a : n " + url, "", JOptionPane.ERROR_MESSAGE);
System.out.println(ex.getMessage());
catch (ClassNotFoundException e)
JOptionPane.showMessageDialog(null, "Error al cargar el driver", "", JOptionPane.ERROR_MESSAGE);
System.out.println(e.getMessage());




enter image description here



enter image description here



These are the values ​​that I send to my class connection



c= new conexion("jdbc:mysql://", "127.0.0.1/", "root", "", "sanciones");
c.conectar();



And then I detail the connection class constructor



 public conexion(String driver,String host, String usuario, String 
contraseña, String baseDatos)
this.usuario = usuario;
this.contraseña = contraseña;
this.baseDatos = baseDatos;
this.driver = driver;
this.host = host;
this.url = driver + this.host + this.baseDatos;



UPGRADE



The driver versions com.mysql.jdbc_5.1.5 do not allow the implicit loading of the driver due to the lack of the Services subfolder in META-INF and its corresponding content, even if it is JDBC4 and in the mysql manuals it is said that it is possible, it is not, at least with this specific version, greetings










share|improve this question















I currently use Intellij, it turns out that I am trying to connect to a MySQL database, but after adding the library and using a connection class which works perfectly with the MariaDB driver, I find the error in the question title



public void conectar() 
try
conexion = DriverManager.getConnection(url, usuario, contraseña);
if (conexion != null) JOptionPane.showMessageDialog(null, "Conexión establecida a : n" + url, "ACDA2", JOptionPane.INFORMATION_MESSAGE);
Class.forName("com.mysql.jdbc.Driver");
stm = conexion.createStatement();//crea un objeto que permite enviar instrucciones a la base de datos

catch (SQLException ex)
JOptionPane.showMessageDialog(null, "Conexión fallida a : n " + url, "", JOptionPane.ERROR_MESSAGE);
System.out.println(ex.getMessage());
catch (ClassNotFoundException e)
JOptionPane.showMessageDialog(null, "Error al cargar el driver", "", JOptionPane.ERROR_MESSAGE);
System.out.println(e.getMessage());




enter image description here



enter image description here



These are the values ​​that I send to my class connection



c= new conexion("jdbc:mysql://", "127.0.0.1/", "root", "", "sanciones");
c.conectar();



And then I detail the connection class constructor



 public conexion(String driver,String host, String usuario, String 
contraseña, String baseDatos)
this.usuario = usuario;
this.contraseña = contraseña;
this.baseDatos = baseDatos;
this.driver = driver;
this.host = host;
this.url = driver + this.host + this.baseDatos;



UPGRADE



The driver versions com.mysql.jdbc_5.1.5 do not allow the implicit loading of the driver due to the lack of the Services subfolder in META-INF and its corresponding content, even if it is JDBC4 and in the mysql manuals it is said that it is possible, it is not, at least with this specific version, greetings







mysql mariadb






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 '18 at 9:52

























asked Nov 10 '18 at 13:12









Rafael Valls

1014




1014











  • My guess is that the MySQL/MariaDB driver JAR is not on your classpath, and is therefore not available at runtime.
    – Tim Biegeleisen
    Nov 10 '18 at 13:18
















  • My guess is that the MySQL/MariaDB driver JAR is not on your classpath, and is therefore not available at runtime.
    – Tim Biegeleisen
    Nov 10 '18 at 13:18















My guess is that the MySQL/MariaDB driver JAR is not on your classpath, and is therefore not available at runtime.
– Tim Biegeleisen
Nov 10 '18 at 13:18




My guess is that the MySQL/MariaDB driver JAR is not on your classpath, and is therefore not available at runtime.
– Tim Biegeleisen
Nov 10 '18 at 13:18












2 Answers
2






active

oldest

votes


















0














Class.forName should be called before getting connection






share|improve this answer




















  • This works!!! but I have a great doubt, I read that class for name is not necessary for the operation of the library, why would it be necessary to place it in this case?
    – Rafael Valls
    Nov 10 '18 at 14:11










  • Because to get the connection you need to load the driver first.
    – Killer
    Nov 10 '18 at 14:14










  • but if I use the mariadb driver, it works for me by loading it later: /
    – Rafael Valls
    Nov 10 '18 at 14:20


















0














"Class.forName" need to be called first to load the proper driver first.Try this,



 try {
Class.forName("com.mysql.jdbc.Driver");
conexion = DriverManager.getConnection(url, usuario, contraseña);
if (conexion != null) JOptionPane.showMessageDialog(null, "Conexión establecida a : n" + url, "ACDA2", JOptionPane.INFORMATION_MESSAGE);
stm = conexion.createStatement();//crea un objeto que permite enviar instrucciones a la base de datos






share|improve this answer




















  • Oh nice its work, you know why with mariadb driver I can called Class.forName after?
    – Rafael Valls
    Nov 10 '18 at 14:24










  • Don't know this, thanks for the info, will check..
    – Killer
    Nov 10 '18 at 14:28










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239288%2fmysql-no-suitable-driver-found%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Class.forName should be called before getting connection






share|improve this answer




















  • This works!!! but I have a great doubt, I read that class for name is not necessary for the operation of the library, why would it be necessary to place it in this case?
    – Rafael Valls
    Nov 10 '18 at 14:11










  • Because to get the connection you need to load the driver first.
    – Killer
    Nov 10 '18 at 14:14










  • but if I use the mariadb driver, it works for me by loading it later: /
    – Rafael Valls
    Nov 10 '18 at 14:20















0














Class.forName should be called before getting connection






share|improve this answer




















  • This works!!! but I have a great doubt, I read that class for name is not necessary for the operation of the library, why would it be necessary to place it in this case?
    – Rafael Valls
    Nov 10 '18 at 14:11










  • Because to get the connection you need to load the driver first.
    – Killer
    Nov 10 '18 at 14:14










  • but if I use the mariadb driver, it works for me by loading it later: /
    – Rafael Valls
    Nov 10 '18 at 14:20













0












0








0






Class.forName should be called before getting connection






share|improve this answer












Class.forName should be called before getting connection







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 10 '18 at 14:05









vinay chhabra

53937




53937











  • This works!!! but I have a great doubt, I read that class for name is not necessary for the operation of the library, why would it be necessary to place it in this case?
    – Rafael Valls
    Nov 10 '18 at 14:11










  • Because to get the connection you need to load the driver first.
    – Killer
    Nov 10 '18 at 14:14










  • but if I use the mariadb driver, it works for me by loading it later: /
    – Rafael Valls
    Nov 10 '18 at 14:20
















  • This works!!! but I have a great doubt, I read that class for name is not necessary for the operation of the library, why would it be necessary to place it in this case?
    – Rafael Valls
    Nov 10 '18 at 14:11










  • Because to get the connection you need to load the driver first.
    – Killer
    Nov 10 '18 at 14:14










  • but if I use the mariadb driver, it works for me by loading it later: /
    – Rafael Valls
    Nov 10 '18 at 14:20















This works!!! but I have a great doubt, I read that class for name is not necessary for the operation of the library, why would it be necessary to place it in this case?
– Rafael Valls
Nov 10 '18 at 14:11




This works!!! but I have a great doubt, I read that class for name is not necessary for the operation of the library, why would it be necessary to place it in this case?
– Rafael Valls
Nov 10 '18 at 14:11












Because to get the connection you need to load the driver first.
– Killer
Nov 10 '18 at 14:14




Because to get the connection you need to load the driver first.
– Killer
Nov 10 '18 at 14:14












but if I use the mariadb driver, it works for me by loading it later: /
– Rafael Valls
Nov 10 '18 at 14:20




but if I use the mariadb driver, it works for me by loading it later: /
– Rafael Valls
Nov 10 '18 at 14:20













0














"Class.forName" need to be called first to load the proper driver first.Try this,



 try {
Class.forName("com.mysql.jdbc.Driver");
conexion = DriverManager.getConnection(url, usuario, contraseña);
if (conexion != null) JOptionPane.showMessageDialog(null, "Conexión establecida a : n" + url, "ACDA2", JOptionPane.INFORMATION_MESSAGE);
stm = conexion.createStatement();//crea un objeto que permite enviar instrucciones a la base de datos






share|improve this answer




















  • Oh nice its work, you know why with mariadb driver I can called Class.forName after?
    – Rafael Valls
    Nov 10 '18 at 14:24










  • Don't know this, thanks for the info, will check..
    – Killer
    Nov 10 '18 at 14:28















0














"Class.forName" need to be called first to load the proper driver first.Try this,



 try {
Class.forName("com.mysql.jdbc.Driver");
conexion = DriverManager.getConnection(url, usuario, contraseña);
if (conexion != null) JOptionPane.showMessageDialog(null, "Conexión establecida a : n" + url, "ACDA2", JOptionPane.INFORMATION_MESSAGE);
stm = conexion.createStatement();//crea un objeto que permite enviar instrucciones a la base de datos






share|improve this answer




















  • Oh nice its work, you know why with mariadb driver I can called Class.forName after?
    – Rafael Valls
    Nov 10 '18 at 14:24










  • Don't know this, thanks for the info, will check..
    – Killer
    Nov 10 '18 at 14:28













0












0








0






"Class.forName" need to be called first to load the proper driver first.Try this,



 try {
Class.forName("com.mysql.jdbc.Driver");
conexion = DriverManager.getConnection(url, usuario, contraseña);
if (conexion != null) JOptionPane.showMessageDialog(null, "Conexión establecida a : n" + url, "ACDA2", JOptionPane.INFORMATION_MESSAGE);
stm = conexion.createStatement();//crea un objeto que permite enviar instrucciones a la base de datos






share|improve this answer












"Class.forName" need to be called first to load the proper driver first.Try this,



 try {
Class.forName("com.mysql.jdbc.Driver");
conexion = DriverManager.getConnection(url, usuario, contraseña);
if (conexion != null) JOptionPane.showMessageDialog(null, "Conexión establecida a : n" + url, "ACDA2", JOptionPane.INFORMATION_MESSAGE);
stm = conexion.createStatement();//crea un objeto que permite enviar instrucciones a la base de datos







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 10 '18 at 14:13









Killer

4691519




4691519











  • Oh nice its work, you know why with mariadb driver I can called Class.forName after?
    – Rafael Valls
    Nov 10 '18 at 14:24










  • Don't know this, thanks for the info, will check..
    – Killer
    Nov 10 '18 at 14:28
















  • Oh nice its work, you know why with mariadb driver I can called Class.forName after?
    – Rafael Valls
    Nov 10 '18 at 14:24










  • Don't know this, thanks for the info, will check..
    – Killer
    Nov 10 '18 at 14:28















Oh nice its work, you know why with mariadb driver I can called Class.forName after?
– Rafael Valls
Nov 10 '18 at 14:24




Oh nice its work, you know why with mariadb driver I can called Class.forName after?
– Rafael Valls
Nov 10 '18 at 14:24












Don't know this, thanks for the info, will check..
– Killer
Nov 10 '18 at 14:28




Don't know this, thanks for the info, will check..
– Killer
Nov 10 '18 at 14:28

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239288%2fmysql-no-suitable-driver-found%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)