7 Commits

7 changed files with 82 additions and 0 deletions
BIN
View File
Binary file not shown.
Binary file not shown.
+9
View File
@@ -0,0 +1,9 @@
-- Table principale : les rappels
CREATE TABLE rappel (
id INT AUTO_INCREMENT PRIMARY KEY,
titre VARCHAR(50) NOT NULL,
contenu TEXT,
theme VARCHAR(30),
rang INT
);
View File
@@ -0,0 +1,38 @@
package fr.iutfbleau.papillon.model;
import org.mariadb.jdbc.MariaDbDataSource;
import java.sql.Connection;
import java.sql.SQLException;
public class BaseDeDonnees {
private static Connection connexion;
public static Connection getConnexion() {
if (connexion == null) {
try {
MariaDbDataSource dataSource = new MariaDbDataSource();
dataSource.setUrl("jdbc:mariadb://localhost:3307/papillon");
dataSource.setUser("root");
dataSource.setPassword("mdp");
connexion = dataSource.getConnection();
System.out.println(" Connexion réussie !");
} catch (SQLException e) {
e.printStackTrace();
}
}
return connexion;
}
public static void fermer() {
try {
if (connexion != null && !connexion.isClosed()) {
connexion.close();
System.out.println(" Connexion fermée.");
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,35 @@
package fr.iutfbleau.papillon.model;
public class Rappel {
private int id;
private String titre;
private String contenu;
private LocalDateTime date;
public Rappel(int id, String titre, String contenu, LocalDateTime date) {
this.id = id;
this.titre = titre;
this.contenu = contenu;
this.date = date;
}
public Rappel(String titre, String contenu, String theme, int rang){
this(0,titre,contenu,theme,rang);
}
public int getId(){
return id;
}
public String getTitre(){
return titre;
}
public String getContenu(){
return contenu;
}
public String getTheme(){
return theme;
}
public int getRang(){
return rang;
}
}