27 lines
570 B
Java
27 lines
570 B
Java
![]() |
import java.sql.*;
|
||
|
|
||
|
public class MonProgramme {
|
||
|
|
||
|
public static void main(String[] args){
|
||
|
|
||
|
Connexion cnx = null;
|
||
|
|
||
|
try {
|
||
|
Class.forName("org.mariadb.jdbc.Driver");
|
||
|
cnx = DriverManager.getConnection("jdbc:mariadb://dwarves.iut-fbleau.fr/srivasta","srivasta", "Tiamzon2006");
|
||
|
System.out.println("Connexion réussie ! ");
|
||
|
|
||
|
} catch(ClassNotFoundException e) {
|
||
|
System.err.println("Classe non trouvee "+e);
|
||
|
}
|
||
|
|
||
|
if(cnx != null){
|
||
|
try{
|
||
|
cnx.close();
|
||
|
}catch(SQLException e) {
|
||
|
System.err.println("Erreur lors de la fermeture : "+e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|