Connection con;
try {
con = getConnection();
((DBTransactionalDriver) driver).beginTrans(con);
} catch (SQLException e) {
throw new DriverException(e);
}
}
for (int i = 0; i < dataSource.getRowCount(); i++) {
Value[] row = new Value[dataSource.getFieldNames().length];
for (int j = 0; j < row.length; j++) {
row[j] = dataSource.getFieldValue(i, j);
}
try {
driver.execute(getConnection(), InnerDBUtils
.createInsertStatement(def.getTableName(), row, dataSource.getFieldNames(),
driver));
} catch (SQLException e) {
if (driver instanceof DBTransactionalDriver) {
try {
Connection con = getConnection();
((DBTransactionalDriver) driver).rollBackTrans(con);
} catch (SQLException e1) {
throw new DriverException(e1);
}
}
throw new DriverException(e);
}
}
if (driver instanceof DBTransactionalDriver) {
try {
Connection con = getConnection();
((DBTransactionalDriver) driver).commitTrans(con);
} catch (SQLException e) {
throw new DriverException(e);
}
}
dataSource.stop();
}