Connection a une base mysql
supcomingénieur
Messages postés
74
Date d'inscription
Statut
Membre
Dernière intervention
-
malaik5 Messages postés 258 Date d'inscription Statut Membre Dernière intervention -
malaik5 Messages postés 258 Date d'inscription Statut Membre Dernière intervention -
bonsoir, svp aidez moi c'est urgent!!!!
j'ai une erreure de type : java.sql.SQLException: Access denied for user 'root root'@'localhost' (using password: YES)
voila le code. je sais pas ou réside l'erreur
public boolean authenticate (String login ,String pass)
{
String username = "root";
String password = "rooti";
String url = "jdbc:mysql://localhost:3306/OtpAuthentication";
try{
//connexion base
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connexion = DriverManager.getConnection(url,username,password);
Statement instruction = connexion.createStatement();
ResultSet resultat = instruction.executeQuery("SELECT * FROM utilisateur");
while(resultat.next())
{
if ((login.equals(resultat.getString("login"))) && (pass.equals(resultat.getString("password"))))
{
userExist=true;
//return (aux);
}
else
{
userExist=false;
// return (aux);
}
}
}
catch (Exception e)
{
System.out.println("echec pilote : "+e);
}
return(userExist);
}
j'ai une erreure de type : java.sql.SQLException: Access denied for user 'root root'@'localhost' (using password: YES)
voila le code. je sais pas ou réside l'erreur
public boolean authenticate (String login ,String pass)
{
String username = "root";
String password = "rooti";
String url = "jdbc:mysql://localhost:3306/OtpAuthentication";
try{
//connexion base
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connexion = DriverManager.getConnection(url,username,password);
Statement instruction = connexion.createStatement();
ResultSet resultat = instruction.executeQuery("SELECT * FROM utilisateur");
while(resultat.next())
{
if ((login.equals(resultat.getString("login"))) && (pass.equals(resultat.getString("password"))))
{
userExist=true;
//return (aux);
}
else
{
userExist=false;
// return (aux);
}
}
}
catch (Exception e)
{
System.out.println("echec pilote : "+e);
}
return(userExist);
}
A voir également:
- Connection a une base mysql
- Se connecter à gmail sur téléphone - Guide
- Base de registre - Guide
- Comment connecter chromecast à la télé - Guide
- Se connecter à ma boite hotmail - Guide
- Mysql community server - Télécharger - Bases de données