Mise à jour de 'DonjonBdB.java'
This commit is contained in:
parent
df0fed87b1
commit
1b57ceb42c
@ -1,12 +1,28 @@
|
||||
public class DonjonBd extends Donjon{
|
||||
|
||||
public void connection(){
|
||||
Connection cnx = DriverManager.getConnection(
|
||||
"jdbc:mariadb://dwarves.iut-fbleau.fr/elhaddad",
|
||||
"elhaddad", "NassimPHP77550");
|
||||
|
||||
try{
|
||||
public Connection getConnection(){
|
||||
try {
|
||||
try {
|
||||
Class.forName("org.mariadb.jdbc.Driver");
|
||||
}catch(ClassNotFoundException);
|
||||
} catch (ClassNotFoundException e) {
|
||||
System.err.println("La classe permettant la connexion au serveur SQL n'a pas été ouverte à l'exécution");
|
||||
return null;
|
||||
}
|
||||
cnx = DriverManager.getConnection("jdbc:mariadb://dwarves.iut-fbleau.fr/elhaddad",
|
||||
"elhaddad", "NassimPHP77550");
|
||||
} catch (SQLException e) {
|
||||
System.err.println("Connexion échouée");
|
||||
}
|
||||
return cnx;
|
||||
}
|
||||
|
||||
public void Fermeture(){
|
||||
try {
|
||||
cnx.close();
|
||||
} catch (SQLException e) {
|
||||
System.err.println("Erreur dans la fermeture");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user