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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
| package com.cerpbn.extranet.traca.bdd;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Call extends DatabaseAccessTraca{
private String codeClient;
private String dateDeb;
private String dateFin;
private String stmin;
private String stmax;
private String refulg;
private String typacc;
private CallableStatement cs;
private String sql;
private ResultSet resultat;
public Call(String cclient, String refBac, String dateD, String dateF){
codeClient = cclient;
refulg = refBac;
dateDeb = dateD;
dateFin = dateF;
stmin = "";
stmax = "";
refulg = refBac;
typacc = "";
}
public ResultSet requeteHisto(){
try{
connect();
System.out.println("Code client : " + codeClient);
System.out.println("RefBac : " + refulg);
System.out.println("avant le call : ok");
sql = "CALL UB0222P(?,?,?,?,?,?,?)";
cs = con.prepareCall(sql); //Construction du Call
System.out.println("après le preparecall : ok");
stmin = "00"; //Statut Minimum (de 00 à 99)
stmax = "99"; //Statut Maximum (de 00 à 99)
//Les statuts permettents de délimiter les critères de sélection au niveau du bac par rapport à ses références
typacc = "3"; //Type d'accès :
//Valeurs du type d'accès (A SAISIR OBLIGATOIREMENT):
//1 => Client destinataire
//2 => Client expediteur
//3 => Cycle ULG (pour l'historique du bac)
//On remplit les paramètres du Call par les paramètres rentrés ci-dessus
cs.setString(1,codeClient);
cs.setString(2,dateDeb);
cs.setString(3,dateFin);
cs.setString(4,stmin);
cs.setString(5,stmax);
cs.setString(6,refulg);
cs.setString(7,typacc);
System.out.println("avant le call execute : ok");
if(cs.execute()){
return resultat = cs.getResultSet();
}
disconnect();
}
catch(Exception e) {
while (e != null)
{
System.out.println("Message: " + e.getMessage());
System.out.println("SQLState: " + ((SQLException) e).getSQLState());
System.out.println("ErrorCode: " + ((SQLException) e).getErrorCode());
e = ((SQLException) e).getNextException();
}
}
return resultat;
}
} |
Partager