アットウィキロゴ

がめxxc

import java.sql.*;

class gamex{

String url = "jdbc:derby:db;create=true";  
String usr = "";  
String pwd = "";

int dbnum;
int comp[]=new int[10000];
double oprice[]=new double[10000];
double hprice[]=new double[10000];
double lprice[]=new double[10000];
double cprice[]=new double[10000];
double volume[]=new double[10000];
String date[]=new String[100000];
Connection dbx;    
Statement  stx;
ResultSet rsx;
int s,kai;
String item;
double x1,x2,x3,x4,x5;

void sqldata(){

dbnum=0;

s=0;

try {
      dbx = DriverManager.getConnection(url, usr, pwd);
      stx = dbx.createStatement();

      rsx = stx.executeQuery("select * from zgoogle");
      if (rsx != null) {
        while (rsx.next()) {
s = rsx.getInt("keyword");        
kai = rsx.getInt("company");
item = rsx.getString("date");
x1 = rsx.getDouble("oprice");
x2 = rsx.getDouble("hprice");
x3 = rsx.getDouble("lprice");
x4 = rsx.getDouble("cprice");
x5 = rsx.getDouble("volume");

comp[s]=kai;
date[s]=item;
oprice[s]=x1;
hprice[s]=x2;
lprice[s]=x3;
cprice[s]=x4;
volume[s]=x5;

}
}

dbnum=s;

rsx.close();
stx.close();
dbx.close();

} catch (Exception ex) {ex.printStackTrace();}  

}

}
最終更新:2011年03月28日 18:30