Hi Everyone,
I use the java method below to performs inserts to a mysql database. The method
works great now, but I am concerned about what will happen when it is moved from
a test environment to a production environment. I am concerned that the
executeQuery(query) statement will take a long time when the table it is
accessing contains thousands of records. Any thoughts?
Many Thanks,
Mike
public void insert(Row row, Table table) throws SQLException {
Column column;
Statement stmt =
table.getConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String query = "SELECT * FROM " + table.getTableName();
ResultSet rs = stmt.executeQuery(query);
Iterator iter = row.getColumnIterator();
rs.moveToInsertRow();
while (iter.hasNext()) {
column = (Column) iter.next();
rs.updateObject(column.getColumnName(), column.getColumnValue());
}
rs.insertRow();
}