Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.apache.commons.lang.time.StopWatch;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.Statement;
- import java.util.Properties;
- public class H2Access {
- public static void main(String[] args) throws Exception {
- Class.forName("org.h2.Driver");
- Properties props = new Properties();
- props.setProperty("user","sa");
- props.setProperty("password","test");
- Connection conn = DriverManager.getConnection("jdbc:h2:tcp://localhost/~/h2/test",props);
- Statement stat = conn.createStatement();
- StopWatch stopwatch = new StopWatch();
- stopwatch.start();
- for (int i = 0; i < 1000000; i++) {
- stat.execute("insert into test(id,name,field,f2) values(nextval('RESTART'),'Hello','a','a')");
- }
- stopwatch.stop();
- long timeTaken = stopwatch.getTime();
- System.out.println("Done in "+timeTaken);
- conn.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement