Connexion SQL + début connexion praticien #14

Merged
medhi.rodrigues merged 1 commits from MedhiJava into main 2025-03-12 14:46:06 +01:00
5 changed files with 48 additions and 9 deletions
Showing only changes of commit d8f091dcc3 - Show all commits

View File

@ -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=\

View File

@ -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");
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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");