Connexion SQL + début connexion praticien
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -51,10 +51,10 @@ public class connexionSQL {
|
||||
* @return connection <20>tablie
|
||||
*/
|
||||
public static Connection getConnect(String serveur, String bdd, String nomUtil, String mdp) {
|
||||
System.out.println("Connexion valid<69>");
|
||||
if (connect == null) {
|
||||
new connexionSQL(serveur, bdd, nomUtil, mdp);
|
||||
}
|
||||
System.out.println("Connexion valid<69>");
|
||||
return connect;
|
||||
}
|
||||
}
|
||||
|
@@ -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<63>s <20> la table client
|
||||
result = stmt.executeQuery("SELECT * FROM client WHERE nom='"+login+
|
||||
"' AND mdp='"+mdp + "';");
|
||||
if (result.next()) { // Le client a <20>t<EFBFBD> touv<75>
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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");
|
||||
|
Reference in New Issue
Block a user