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
|
public static void main(String[] args) {
try{
// Chargement des drivers SQL
Class.forName ("com.mysql.Driver").newInstance();
}
catch (ClassNotFoundException a){
System.out.println ("Driver non trouve");
}
catch (Exception b){
System.out.println ("Problème sur chargement de driver JDBC");
}
try
{
// Etablissement de la connexion avec la base
connection = DriverManager.getConnection ("jdbc:mysql://localhost/gedo", "root", "");
}
catch (SQLException c){
System.out.println ("Connexion refusée ou base inconnue");
}
catch (Exception d){
System.out.println ("Problème sur connexion");
}
} |
Partager