Connexion SQL + début connexion praticien
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user