MYSQL No suitable driver found
up vote
0
down vote
favorite
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
add a comment |
up vote
0
down vote
favorite
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
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 at 13:18
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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
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
mysql mariadb
edited Nov 12 at 9:52
asked Nov 10 at 13:12
Rafael Valls
1063
1063
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 at 13:18
add a comment |
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 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 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 at 13:18
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
Class.forName should be called before getting connection
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 at 14:11
Because to get the connection you need to load the driver first.
– Killer
Nov 10 at 14:14
but if I use the mariadb driver, it works for me by loading it later: /
– Rafael Valls
Nov 10 at 14:20
add a comment |
up vote
0
down vote
"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
Oh nice its work, you know why with mariadb driver I can called Class.forName after?
– Rafael Valls
Nov 10 at 14:24
Don't know this, thanks for the info, will check..
– Killer
Nov 10 at 14:28
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Class.forName should be called before getting connection
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 at 14:11
Because to get the connection you need to load the driver first.
– Killer
Nov 10 at 14:14
but if I use the mariadb driver, it works for me by loading it later: /
– Rafael Valls
Nov 10 at 14:20
add a comment |
up vote
0
down vote
Class.forName should be called before getting connection
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 at 14:11
Because to get the connection you need to load the driver first.
– Killer
Nov 10 at 14:14
but if I use the mariadb driver, it works for me by loading it later: /
– Rafael Valls
Nov 10 at 14:20
add a comment |
up vote
0
down vote
up vote
0
down vote
Class.forName should be called before getting connection
Class.forName should be called before getting connection
answered Nov 10 at 14:05
vinay chhabra
52937
52937
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 at 14:11
Because to get the connection you need to load the driver first.
– Killer
Nov 10 at 14:14
but if I use the mariadb driver, it works for me by loading it later: /
– Rafael Valls
Nov 10 at 14:20
add a comment |
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 at 14:11
Because to get the connection you need to load the driver first.
– Killer
Nov 10 at 14:14
but if I use the mariadb driver, it works for me by loading it later: /
– Rafael Valls
Nov 10 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 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 at 14:11
Because to get the connection you need to load the driver first.
– Killer
Nov 10 at 14:14
Because to get the connection you need to load the driver first.
– Killer
Nov 10 at 14:14
but if I use the mariadb driver, it works for me by loading it later: /
– Rafael Valls
Nov 10 at 14:20
but if I use the mariadb driver, it works for me by loading it later: /
– Rafael Valls
Nov 10 at 14:20
add a comment |
up vote
0
down vote
"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
Oh nice its work, you know why with mariadb driver I can called Class.forName after?
– Rafael Valls
Nov 10 at 14:24
Don't know this, thanks for the info, will check..
– Killer
Nov 10 at 14:28
add a comment |
up vote
0
down vote
"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
Oh nice its work, you know why with mariadb driver I can called Class.forName after?
– Rafael Valls
Nov 10 at 14:24
Don't know this, thanks for the info, will check..
– Killer
Nov 10 at 14:28
add a comment |
up vote
0
down vote
up vote
0
down vote
"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
"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
answered Nov 10 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 at 14:24
Don't know this, thanks for the info, will check..
– Killer
Nov 10 at 14:28
add a comment |
Oh nice its work, you know why with mariadb driver I can called Class.forName after?
– Rafael Valls
Nov 10 at 14:24
Don't know this, thanks for the info, will check..
– Killer
Nov 10 at 14:28
Oh nice its work, you know why with mariadb driver I can called Class.forName after?
– Rafael Valls
Nov 10 at 14:24
Oh nice its work, you know why with mariadb driver I can called Class.forName after?
– Rafael Valls
Nov 10 at 14:24
Don't know this, thanks for the info, will check..
– Killer
Nov 10 at 14:28
Don't know this, thanks for the info, will check..
– Killer
Nov 10 at 14:28
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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 at 13:18