diff --git a/GSBapplication/nbproject/project.properties b/GSBapplication/nbproject/project.properties index 5de7fdf..1383aba 100644 --- a/GSBapplication/nbproject/project.properties +++ b/GSBapplication/nbproject/project.properties @@ -1,9 +1,10 @@ annotation.processing.enabled=true annotation.processing.enabled.in.editor=false -annotation.processing.processor.options= annotation.processing.processors.list= annotation.processing.run.all.processors=true annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=GSBapplication +application.vendor=medhi.rodrigues build.classes.dir=${build.dir}/classes build.classes.excludes=**/*.java,**/*.form # This directory is removed when the project is cleaned: @@ -32,6 +33,7 @@ dist.jar=${dist.dir}/GSBapplication.jar dist.javadoc.dir=${dist.dir}/javadoc dist.jlink.dir=${dist.dir}/jlink dist.jlink.output=${dist.jlink.dir}/GSBapplication +endorsed.classpath= excludes= file.reference.mysql-connector-j-8.3.0.jar=C:\\Users\\medhi.rodrigues\\Documents\\NetBeansProjects\\Driver\\mysql-connector-j-8.3.0.jar includes=** @@ -81,10 +83,6 @@ platform.active=default_platform run.classpath=\ ${javac.classpath}:\ ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project. -# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. -# To set system properties for unit tests define test-sys-prop.name=value: -run.jvmargs= run.modulepath=\ ${javac.modulepath} run.test.classpath=\ diff --git a/GSBapplication/src/TEST/testMain.java b/GSBapplication/src/TEST/testMain.java index 0e78631..e6dd63a 100644 --- a/GSBapplication/src/TEST/testMain.java +++ b/GSBapplication/src/TEST/testMain.java @@ -19,7 +19,11 @@ public class testMain { public static void main(String[] args) { Connection connexionTest = connexionSQL.getConnect("10.121.38.196","bdgsb","adminGSB","mdpGSB"); - + //Elio + //Connection connexionTest = connexionSQL.getConnect("10.121.38.75","bdgsb","adminGSB","mdpGSB"); + //Yann + //Connection connexionTest = connexionSQL.getConnect("10.121.38.69","bdgsb","appliGSB","(Uq1XV0Tr01s2H9Z"); } + } diff --git a/GSBapplication/src/acces_aux_donnes/connexionSQL.java b/GSBapplication/src/acces_aux_donnes/connexionSQL.java index b83de12..550ef5c 100644 --- a/GSBapplication/src/acces_aux_donnes/connexionSQL.java +++ b/GSBapplication/src/acces_aux_donnes/connexionSQL.java @@ -51,10 +51,10 @@ public class connexionSQL { * @return connection établie */ public static Connection getConnect(String serveur, String bdd, String nomUtil, String mdp) { - System.out.println("Connexion validé"); if (connect == null) { new connexionSQL(serveur, bdd, nomUtil, mdp); } + System.out.println("Connexion validé"); return connect; } } diff --git a/GSBapplication/src/acces_aux_donnes/praticienSQL.java b/GSBapplication/src/acces_aux_donnes/praticienSQL.java index d11e48a..ef9868d 100644 --- a/GSBapplication/src/acces_aux_donnes/praticienSQL.java +++ b/GSBapplication/src/acces_aux_donnes/praticienSQL.java @@ -4,10 +4,44 @@ */ package acces_aux_donnes; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + /** * * @author emile.lalorcey */ public class praticienSQL { + private Connection connexionTest; + private Statement stmt = null; + private ResultSet result = null; + + public praticienSQL() { + connexionTest = connexionSQL.getConnect("10.121.38.173","bdmagasin", "adminBDMag", "mdpBDMag"); + } + + public String[] rechercherPraticien(String login, String mdp) { + String[] praticienCherche = new String [2]; + try { + stmt = connexionTest.createStatement(); + // Accès à la table client + result = stmt.executeQuery("SELECT * FROM client WHERE nom='"+login+ + "' AND mdp='"+mdp + "';"); + if (result.next()) { // Le client a été touvé + praticienCherche[0] = result.getString(1); + praticienCherche[1] = result.getString(2); + + } + result.close(); + stmt.close(); + } catch (SQLException ex) { + System.out.println("SQLException : " + ex.getMessage()); + System.out.println("SQLState : " + ex.getSQLState()); + System.out.println("Code erreur : " + ex.getErrorCode()); + } + return praticienCherche; + } } diff --git a/GSBapplication/src/presentation/jffConnexion.java b/GSBapplication/src/presentation/jffConnexion.java index bf72fee..5e94ca7 100644 --- a/GSBapplication/src/presentation/jffConnexion.java +++ b/GSBapplication/src/presentation/jffConnexion.java @@ -4,6 +4,8 @@ */ package presentation; +import acces_aux_donnes.praticienSQL; + /** * * @author emile.lalorcey @@ -154,8 +156,9 @@ public class jffConnexion extends javax.swing.JFrame { }//GEN-LAST:event_jPFmdpActionPerformed private void jBValiderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBValiderActionPerformed - String identifiant = "DIDIER"; - String motPasse = "123"; + String identifiant = jTFIdentifiant.getText(); + String motPasse = jPFmdp.getText(); + praticienSQL testPraticien = new praticienSQL(); if (jTFIdentifiant.getText().equals(identifiant) && jPFmdp.getText().equals(motPasse)){ System.out.println("Gagner");