import java.sql.*;
class wordinsert{
int bcode;
String[] word=new String[100];
void makedata(String database,int s){
String url = "jdbc:derby:db;create=true";
String usr = "";
String pwd = "";
Connection dbx;
String sqx;
sqx="insert into ";
sqx=sqx+database;
sqx=sqx+"(bcode,num,word) values (?,?,?)";
try {
dbx = DriverManager.getConnection(url, usr, pwd);
PreparedStatement pstmt = dbx.prepareStatement(sqx);
pstmt.setInt(1,bcode);
pstmt.setInt(2,s);
pstmt.setString(3,word[s]);
int nu = pstmt.executeUpdate();
dbx.close();
}catch (SQLException e){System.out.println("SQLException:" + e.getMessage());}
}
}
最終更新:2011年04月10日 14:20