Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.WEB;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.Statement;
- import javax.jws.WebService;
- import javax.jws.WebMethod;
- import javax.jws.WebParam;
- @WebService(serviceName = "ServicioWEB")
- public class ServicioWEB {
- @WebMethod(operationName = "hello")
- public String hello(@WebParam(name = "name") String txt) {
- return "Hello " + txt + " !";
- }
- @WebMethod(operationName = "validacion")
- public Integer validacion(@WebParam(name = "usuario") String usuario, @WebParam(name = "pass") String pass) {
- try{
- Class.forName("com.mysql.jdbc.Driver");
- Connection cone = DriverManager.getConnection("jdbc:mysql://localhost/VETERINARIA", "root", "");
- String sql = "select * from usuarios where usuario = '@usu' and pass = '@pass'";
- sql = sql.replaceAll("@usu", usuario);
- sql = sql.replaceAll("@pass", pass);
- Statement stm = cone.createStatement();
- ResultSet rs = stm.executeQuery(sql);
- while(rs.next())
- {
- return rs.getInt("nivel");
- }
- return 0;
- }catch(Exception e){
- return 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement