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
New contributor
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
New contributor
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
New contributor
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
New contributor
New contributor
edited Nov 12 at 9:52
New contributor
asked Nov 10 at 13:12
Rafael Valls
1062
1062
New contributor
New contributor
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 |
Rafael Valls is a new contributor. Be nice, and check out our Code of Conduct.
Rafael Valls is a new contributor. Be nice, and check out our Code of Conduct.
Rafael Valls is a new contributor. Be nice, and check out our Code of Conduct.
Rafael Valls is a new contributor. Be nice, and check out our Code of Conduct.
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