📄 database.java
字号:
package client;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class DataBase {
/* public Connection connection(){
Connection connect = null;
try{
Class.forName("oracle.jdbc.driver.OracleDriver" );
connect = (Connection) DriverManager.getConnection("jdbc:oracle:thin:@192.42.172.3:1523:pcardg", "BMCE_DEV", "pcard001" );
System.out.print("Connexion OK !!" );
}
catch (ClassNotFoundException ex)
{
System.out.print("Classe Introuvable " + ex.getMessage());
}
catch (SQLException ex)
{
System.out.print("Connexion Impossible " + ex.getMessage());
}
finally
{
System.out.print("!!" );
}
return connect;
}
public static List<String> GET_ACCOUNT_INFO(String p_account_number){
String p_code_reponse = null;
String p_devise=null;
DATE p_date_ouverture=null;
String p_raison_sociale=null;
String p_complement_rs=null;
String p_adresse1_residence=null;
String p_adresse2_residence=null;
String p_ville_residence=null;
CHAR p_separateur=null;
String p_pays_courrier=null;
CHAR p_courrier_garde=null;
String p_tel_domicile =null;
String p_code_postal=null;
String p_ville_courrier=null;
String p_espace=null;
String p_racine_charge_clientele=null;
CHAR p_situation_matrimoniale=null;
String p_num_ide=null;
CHAR p_attribut_res=null;
String p_type_client=null;
String p_capital=null;
String p_dirigeant=null;
String p_fonction_dirigeant=null;
CHAR p_statut_compte=null;
String p_code_secteur_act=null;
CHAR p_code_segment =null;
CHAR p_contentieux=null;
CHAR p_espace_1=null;
int returnVal=-3;
Connection con = null;
OracleCallableStatement oraPreStat=null;
try {
con = new DataBase().connection();
oraPreStat = (oracle.jdbc.OracleCallableStatement) con.prepareCall("BEGIN :30 := PCRD_BMCE_JAVA_TOOLS.GET_ACCOUNT_INFO(: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);END;");
oraPreStat.setString(1,p_account_number);
oraPreStat.registerOutParameter(30,OracleTypes.INTEGER);
oraPreStat.registerOutParameter(2,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(3,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(4,OracleTypes.DATE);
oraPreStat.registerOutParameter(5,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(6,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(7,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(8,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(9,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(10,OracleTypes.CHAR);
oraPreStat.registerOutParameter(11,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(12,OracleTypes.CHAR);
oraPreStat.registerOutParameter(13,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(14,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(15,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(16,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(17,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(18,OracleTypes.CHAR);
oraPreStat.registerOutParameter(19,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(20,OracleTypes.CHAR);
oraPreStat.registerOutParameter(21,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(22,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(23,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(24,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(25,OracleTypes.CHAR);
oraPreStat.registerOutParameter(26,OracleTypes.VARCHAR);
oraPreStat.registerOutParameter(27,OracleTypes.CHAR);
oraPreStat.registerOutParameter(28,OracleTypes.CHAR);
oraPreStat.registerOutParameter(29,OracleTypes.CHAR);
CHAR c=null;
DATE d=null;
oraPreStat.executeUpdate();
p_code_reponse = (String) oraPreStat.getString(2);
p_devise = (String) oraPreStat.getString(3);
p_date_ouverture= oraPreStat.getDATE(4);
p_raison_sociale = (String) oraPreStat.getString(5);
p_complement_rs = (String) oraPreStat.getString(6);
p_adresse1_residence = (String) oraPreStat.getString(7);
p_adresse2_residence = (String) oraPreStat.getString(8);
p_ville_residence = (String) oraPreStat.getString(9);
p_separateur= oraPreStat.getCHAR(10);
p_pays_courrier = (String) oraPreStat.getString(11);
p_courrier_garde= oraPreStat.getCHAR(12);
p_tel_domicile = (String) oraPreStat.getString(13);
p_code_postal = (String) oraPreStat.getString(14);
p_ville_courrier = (String) oraPreStat.getString(15);
p_espace = (String) oraPreStat.getString(16);
p_racine_charge_clientele = (String) oraPreStat.getString(17);
p_situation_matrimoniale = oraPreStat.getCHAR(18);
p_num_ide = (String) oraPreStat.getString(19);
p_attribut_res= oraPreStat.getCHAR(20);
p_type_client = (String) oraPreStat.getString(21);
p_capital = (String) oraPreStat.getString(22);
p_dirigeant = (String) oraPreStat.getString(23);
p_fonction_dirigeant = (String) oraPreStat.getString(24);
p_statut_compte= oraPreStat.getCHAR(25);
p_code_secteur_act = (String) oraPreStat.getString(26);
p_code_segment = oraPreStat.getCHAR(27);
p_contentieux= oraPreStat.getCHAR(28);
p_espace_1 = oraPreStat.getCHAR(29);
returnVal =oraPreStat.getInt(30);
System.out.println("La valeur de retour est: "+returnVal);
} catch (SQLException e) {
e.printStackTrace();
} finally{
try { con.close(); }
catch (Exception e) {
e.printStackTrace();}}
List<String> retour=new ArrayList<String>();
retour.add(""+returnVal);
retour.add(p_code_reponse);
retour.add(p_devise);
retour.add(p_date_ouverture.toString());
retour.add(p_raison_sociale );
retour.add( p_complement_rs);
retour.add(p_adresse1_residence);
retour.add(p_adresse2_residence);
retour.add(p_ville_residence);
retour.add(p_separateur.toString());
retour.add(p_pays_courrier);
retour.add(p_courrier_garde.toString());
retour.add(p_tel_domicile);
retour.add(p_code_postal);
retour.add(p_ville_courrier);
retour.add(p_espace);
retour.add(p_racine_charge_clientele);
retour.add(p_situation_matrimoniale.toString());
retour.add(p_num_ide);
retour.add(p_attribut_res.toString());
retour.add(p_type_client);
retour.add( p_capital);
retour.add(p_dirigeant);
retour.add(p_fonction_dirigeant);
retour.add(p_statut_compte.toString());
retour.add(p_code_secteur_act);
retour.add(p_code_segment.toString());
retour.add(p_contentieux.toString() );
retour.add(p_espace_1.toString());
return retour;}
public static List<String> GET_CARD_INFO (String p_card_number){
int returnVal=-3;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -