1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.mob;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import java.sql.*;
import javax.jws.WebParam;
import javax.jws.WebMethod;
import javax.jws.WebService;
import java.util.*;
/**
*
* @author souma
*/
@WebService()
public class Table1WS {
/**
* Web service operation
*/
@WebMethod(operationName = "Table1WS")
public List<Table1OutputRow> Table1WS(@WebParam(name = "Gro")
String Gro){
//Gro="wet";
List<Table1OutputRow> outputs=new ArrayList<Table1OutputRow>();
String pilote = "com.mysql.jdbc.Driver";
try {
Class.forName(pilote);
Connection connexion = DriverManager.getConnection("jdbc:mysql://localhost/relation","root","");
Statement instruction = connexion.createStatement();
System.out.println("Connected");
ResultSet resultat = instruction.executeQuery("SELECT * FROM Table1");
while(resultat.next()){
if (resultat.getString("Ground").equals(Gro)){
Table1OutputRow row= new Table1OutputRow();
// row.setSSN(SSN);
row.setDummy(resultat.getString("Dummy"));
row.setWeather(resultat.getString("Weather"));
row.setProb(resultat.getFloat("P"));
outputs.add(row);
}
}
}
catch (Exception e){
System.out.println("echec pilote : "+e);
}
return outputs;
}
} |
Partager