Web service et JDBC
Fermé
futur ingenieure
Messages postés
133
Date d'inscription
jeudi 26 mars 2009
Statut
Membre
Dernière intervention
2 juin 2012
-
20 mai 2011 à 17:28
futur ingenieure Messages postés 133 Date d'inscription jeudi 26 mars 2009 Statut Membre Dernière intervention 2 juin 2012 - 20 mai 2011 à 22:42
futur ingenieure Messages postés 133 Date d'inscription jeudi 26 mars 2009 Statut Membre Dernière intervention 2 juin 2012 - 20 mai 2011 à 22:42
A voir également:
- Web service et JDBC
- Web office - Guide
- Navigateur web - Guide
- Service spouleur - Guide
- Création site web - Guide
- Adresse web - Guide
2 réponses
futur ingenieure
Messages postés
133
Date d'inscription
jeudi 26 mars 2009
Statut
Membre
Dernière intervention
2 juin 2012
1
20 mai 2011 à 19:31
20 mai 2011 à 19:31
pas d'idée SVP
futur ingenieure
Messages postés
133
Date d'inscription
jeudi 26 mars 2009
Statut
Membre
Dernière intervention
2 juin 2012
1
20 mai 2011 à 22:42
20 mai 2011 à 22:42
Voici ci dessous le code que j'avais réaliser
la variable nnoomm me renvoie toujours null
quelle est l'erreur SVP?
package packageWSIdent;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.ejb.Stateless;
@WebService()
@Stateless()
public class IdentificationWebService {
/**
* Web service operation
*/
@WebMethod(operationName = "IdentificationOp")
public String IdentificationOp(@WebParam(name = "login")
String login, @WebParam(name = "pass")
String pass) {
//TODO write your implementation code here:
String nnoomm = null;
try {
String username = "root";
String password = "0000";
Statement stmt;
ResultSet rs;
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url = new String("jdbc:mysql://localhost:3306/mabase");
Connection conn = DriverManager.getConnection(url, username, password);
System.out.println("OK connexion réussie...");
stmt = conn.createStatement();
rs = stmt.executeQuery("select * from clients");
while (rs.next())
{
String l1 = rs.getString("login");
String m1 = rs.getString("password");
if ((l1.equals(login))&& (m1.equals(pass)))
{ String nom = rs.getString("nom");
System.out.println(nom + "\n");
nnoomm=nom;
}
/*else { JOptionPane.showMessageDialog(null, "Valeur incorrecte de nom d'utilisateur ou/et de mot de passe. " , "Erreur",
JOptionPane.ERROR_MESSAGE);
}*/
}
nnoomm=rs.getString("nom");
// rs.close();
// stmt.close();
// conn.close();
// System.out.println("Déconnexion réussie...");
} catch (SQLException ex) {
} catch (InstantiationException ex) {
} catch (IllegalAccessException ex) {
} catch (ClassNotFoundException ex) {
}
return (nnoomm);
}
}
la variable nnoomm me renvoie toujours null
quelle est l'erreur SVP?
package packageWSIdent;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.ejb.Stateless;
@WebService()
@Stateless()
public class IdentificationWebService {
/**
* Web service operation
*/
@WebMethod(operationName = "IdentificationOp")
public String IdentificationOp(@WebParam(name = "login")
String login, @WebParam(name = "pass")
String pass) {
//TODO write your implementation code here:
String nnoomm = null;
try {
String username = "root";
String password = "0000";
Statement stmt;
ResultSet rs;
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url = new String("jdbc:mysql://localhost:3306/mabase");
Connection conn = DriverManager.getConnection(url, username, password);
System.out.println("OK connexion réussie...");
stmt = conn.createStatement();
rs = stmt.executeQuery("select * from clients");
while (rs.next())
{
String l1 = rs.getString("login");
String m1 = rs.getString("password");
if ((l1.equals(login))&& (m1.equals(pass)))
{ String nom = rs.getString("nom");
System.out.println(nom + "\n");
nnoomm=nom;
}
/*else { JOptionPane.showMessageDialog(null, "Valeur incorrecte de nom d'utilisateur ou/et de mot de passe. " , "Erreur",
JOptionPane.ERROR_MESSAGE);
}*/
}
nnoomm=rs.getString("nom");
// rs.close();
// stmt.close();
// conn.close();
// System.out.println("Déconnexion réussie...");
} catch (SQLException ex) {
} catch (InstantiationException ex) {
} catch (IllegalAccessException ex) {
} catch (ClassNotFoundException ex) {
}
return (nnoomm);
}
}