アットウィキロゴ

db5

package memo;
 
 
public class pro {
 
 
    int sx,number;
int[] year=new int[500];
double[] v=new double[30];
 
double[] delta=new double[500];
 
double[] com=new double[500];
double[] tax=new double[500];
String[] im=new String[500];
String[] ex=new String[500];
double[] y=new double[500];
    String[] name=new String[500];
 
public static void main(String[] args) {
        pro t=new pro();
    }
    pro(){
 
 
 
 
        /*(12)固定資本形成*/
 
 
        String db,tab;
 
        db="plus";
        tab="t1";
        int b1,s,c1;
 
 
        namex();
 
      for(b1=1;b1<26;b1++){
 
 
        select sub=new select();
        sub.makedata(db,tab,b1,12);
        number=sub.number;
        ex=sub.v;
        year=sub.year;
 
 
 
   for(s=1;s<number+1;s++){   
   if(year[s]==2013)v[b1]=Double.parseDouble(ex[s]);    
   }
 
 
 
   }
 
 
 
 
    for(s=1;s<26;s++){   
   System.out.println(v[s]);    
   }
 
 
 
 
 
 
 
 
 
 
 
    }
 
 
    void namex(){
 
 
 
name[1]="農林水産業";
name[2]="鉱業";
name[3]="食料品";
name[4]="繊維";
name[5]="パルプ・紙";
name[6]="化学";
name[7]="石油・石炭製品";
name[8]="窯業・土石製品";
name[9]="一次金属";
name[10]="金属製品";
name[11]="一般機械";
name[12]="電気機械";
name[13]="輸送用機械";
name[14]="精密機械";
name[15]="その他の製造業";
name[16]="建設業";
name[17]="電気・ガス・水道業";
name[18]="卸売・小売業";
name[19]="金融・保険業";
name[20]="不動産業";
name[21]="運輸業";
name[22]="情報通信業";
name[23]="サービス業";
name[24]="政府サービス生産者";
name[25]="対家計民間非営利サービス生産者";
 
 
 
 
    }
 
 
 
 
 
     int numx(String str){
 
    int nx;
 
    nx=0;
 
 try{
 
    nx=Integer.parseInt(str);
 
 }catch (Exception e) {}
 
 return nx;
 
 
 
}
 
 
 
 
 
double num(String str){
 
    double nx;
 
    nx=0;
 
 try{
 
    nx=Double.parseDouble(str);
 
 }catch (Exception e) {}
 
 return nx;
 
 
 
}
 
 
 
}
 
 
package memo;
 
import java.sql.*; 
 
class select{ 
 
Connection dbx;   
Statement stx;   
String sqx; 
ResultSet  rsx; 
 
int key; 
String word;
int sx,number;
int[] year=new int[500];
String[] v=new String[500];
 
void makedata(String db,String tab,int b1,int cr){ 
 
String url = "jdbc:h2:"+db+";create=true";   
String usr = "";   
String pwd = ""; 
 
 
 try
          {
            Class.forName("org.h2.Driver");
 
dbx = DriverManager.getConnection(url, usr, pwd); 
} catch (Exception ex) { ex.printStackTrace();} 
 
sx=0;
try {   
stx = dbx.createStatement(); 
sqx="select * from "+tab+" WHERE credit ="+cr+" and bus ="+b1;   
rsx = stx.executeQuery(sqx); 
if (rsx != null) { 
while (rsx.next()) { 
sx=sx+1;
v[sx]= rsx.getString("value");
year[sx]=rsx.getInt("year");
 
} 
} 
 
number=sx;
 
 
rsx.close(); 
stx.close(); 
dbx.close(); 
 
} catch (Exception ex) {ex.printStackTrace();} 
 
 
 
 
} 
 
String change(String word){
String e;
e="'"+word+"'";
return e;    
}    
 
 
 
}
 
最終更新:2015年04月06日 07:37