package ken;
import java.sql.*;
public class table{
Connection dbx;
Statement stx;
String sqx;
ResultSet rsx;
int creditnumber;
String[] credit=new String[50];
String[] style=new String[50];
int[] strlong=new int[50];
void makedata(String db,String tab){
String str;
str="";
int s;
for(s=1;s<creditnumber;s++){
if(style[s].equals("INTEGER"))str=str+credit[s]+" "+style[s]+",";
if(style[s].equals("VARCHAR"))str=str+credit[s]+" "+style[s]+"("+strlong[s]+"),";
}
s=creditnumber;
if(style[s].equals("INTEGER"))str=str+credit[s]+" "+style[s];
if(style[s].equals("VARCHAR"))str=str+credit[s]+" "+style[s]+"("+strlong[s]+")";
String url = "jdbc:h2:"+db+";create=true";
String usr = "";
String pwd = "";
try{
Class.forName("org.h2.Driver");
dbx = DriverManager.getConnection(url, usr, pwd);
stx = dbx.createStatement();
String sqx = "CREATE TABLE " +tab+"("+str+")";
stx.executeUpdate(sqx);
} catch (Exception ex) { ex.printStackTrace();}
}
}
最終更新:2015年08月15日 07:20