Base de données INSA

This commit is contained in:
Auriane Lartigue 2021-01-02 12:59:34 +04:00
parent 85d3994d90
commit d91a67fa86
13 changed files with 93 additions and 20 deletions

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path=""/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="mysql-connector-java-8.0.22.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

1
Implementation/bin/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/bin/

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Implementation</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=13
org.eclipse.jdt.core.compiler.compliance=13
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=13

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="lib" path="gradle/wrapper/gradle-wrapper.jar"/>
<classpathentry kind="output" path="build/classes/java/main"/>
</classpath>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>chatapp</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1 @@
/chatapp/

View file

@ -1,7 +1,12 @@
chatapp/Launcher.java
chatapp.Launcher
chatapp/View/ConnexionScreen.java
chatapp.View.ConnexionScreen
chatapp/Protocol/RunnerEcouteTCP.java
chatapp.Protocol.RunnerEcouteTCP
chatapp/View/DemarrerSession.java
chatapp.View.DemarrerSession
chatapp/View/FenetreSession.java
chatapp.View.FenetreSession
chatapp.View.FenetreSession$1
chatapp/Controller/ChatApp.java
chatapp.Controller.ChatApp
chatapp/Model/DataBase.java
@ -10,8 +15,6 @@ chatapp/View/ChangementPseudo.java
chatapp.View.ChangementPseudo
chatapp/Protocol/RunnerEcouteUDP.java
chatapp.Protocol.RunnerEcouteUDP
chatapp/Launcher.java
chatapp.Launcher
chatapp/Model/ListUtilisateurs.java
chatapp.Model.ListUtilisateurs
chatapp/Protocol/UDPEchange.java
@ -21,19 +24,16 @@ chatapp/Model/MessageHorodate.java
chatapp.Model.MessageHorodate
chatapp/Main.java
chatapp.Main
chatapp/View/View_Menu.java
chatapp.View.View_Menu
chatapp/View/Clavardage.java
chatapp.View.Clavardage
chatapp.View.Clavardage$1
chatapp/Protocol/SessionClavardage.java
chatapp.Protocol.SessionClavardage
chatapp/View/ConnexionScreen.java
chatapp.View.ConnexionScreen
chatapp/View/View_Utilisateurs.java
chatapp.View.View_Utilisateurs
chatapp/Model/Utilisateur.java
chatapp.Model.Utilisateur
chatapp/View/FenetreSession.java
chatapp.View.FenetreSession
chatapp.View.FenetreSession$1
chatapp/View/Clavardage.java
chatapp.View.Clavardage
chatapp.View.Clavardage$1
chatapp/View/View_Menu.java
chatapp.View.View_Menu
chatapp/View/DemarrerSession.java
chatapp.View.DemarrerSession

View file

@ -9,7 +9,7 @@ import java.sql.*;
* </p>
*/
public class DataBase {
private final String DBurl = "jdbc:mysql://srv-bdens.insa-toulouse.fr:3306" ;
private final String DBurl = "jdbc:mysql://srv-bdens.insa-toulouse.fr:3306/tp_servlet_006?" ;
private Connection connection = null;
private final String login = "tp_servlet_006";
private final String pswd = "baePh9ei";
@ -54,8 +54,8 @@ public class DataBase {
// Nabil : DECOMMENTER CETTE LIGNE
//this.connection = DriverManager.getConnection("jdbc:mysql://localhost/POO_AL_NM?allowPublicKeyRetrieval=true&useSSL=false", "root", "1234");
// Auriane : DECOMMENTER CETTE LIGNE
this.connection = DriverManager.getConnection("jdbc:mysql://localhost:8889/POO_AL_NM?allowPublicKeyRetrieval=true&useSSL=false", "root", "root");
//this.connection = DriverManager.getConnection(this.DBurl,login,pswd);
//this.connection = DriverManager.getConnection("jdbc:mysql://localhost:8889/POO_AL_NM?allowPublicKeyRetrieval=true&useSSL=false", "root", "root");
this.connection = DriverManager.getConnection(this.DBurl,login,pswd);
System.out.println("Connexion Etablie");
} catch (SQLException e) {
e.printStackTrace();
@ -460,7 +460,13 @@ public class DataBase {
} catch (SQLException throwables) {
throwables.printStackTrace();
}
existe = (!rs.equals(null));
try {
if(rs.next()){
existe = (!rs.equals(null));
}
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return existe;
}

View file

@ -17,6 +17,7 @@ public class Utilisateur {
private final InetAddress ip ;
private final String id ;
Integer TAILLE_MAX = 5;
/**
* Constructeur : Utilisateur
* @param pseudo Le pseudo associe
@ -27,7 +28,10 @@ public class Utilisateur {
this.setPseudo(pseudo) ;
this.setPort(port);
this.ip = ip ;
this.id = ip.getHostName() ;
String aux= ip.getHostName() ;
if(aux.length() > TAILLE_MAX)
aux = aux.substring(0, TAILLE_MAX);
this.id = aux ;
}
public String getPseudo() {

View file

@ -59,7 +59,6 @@ public class SessionClavardage extends Thread {
}
this.derniersMsg = new ArrayList<MessageHorodate>();
this.pcs = new PropertyChangeSupport(this);
this.app.getDb().CreationTableHistorique("Doudou","Marvel");
this.start();
Platform.runLater( () ->
new FenetreSession(this)