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