1 pièce(s) jointe(s)
No suitable driver found for jdbc
Bonjour à tous, je suis à l'apprentissage et j'ai fait une application avec base de donnée. Quand je teste l'application dans eclipse ça marche nikel, mais après avoir créer le jar je rencontre ce problème à l’exécution :Pièce jointe 298585.
voici mon code pour la conneion :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| /**
*
*/
package ci.objis.projet3.dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
* Cette classe est un singleton qui va nous permettre de créer
* la connexion à la base de donées
* @author KRA
*
*/
public class ConnexionBD {
// les variables de connexion
private final static String URL= "jdbc:mysql://localhost/bd_projet";
private final static String LOGIN="root";
private final static String PASSWORD="";
private static Connection con;
/**
* Constructeur sans paramètre
*/
private ConnexionBD() {
}
/**
* methode static permettant de créer la connexion
* si la variale con n'existe pas
* @return
*/
public static Connection getConnexion(){
if(con==null){
try {
con = DriverManager.getConnection(URL,LOGIN,PASSWORD);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return con;
}
return con;
}
} |