Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class H2Test {
- public DataSource dataSource() {
- JdbcDataSource dataSource = new JdbcDataSource();
- dataSource.setUrl("jdbc:h2:./h2/h2");
- return dataSource;
- }
- public void doTest() {
- JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource());
- jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS Message (id INTEGER PRIMARY KEY, text TEXT);");
- long startTime = System.currentTimeMillis();
- for (int i = 0; i < 3000; i++) {
- jdbcTemplate.update("INSERT INTO Message (id, text) VALUES (" + i + ", '123');");
- }
- long endTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - startTime);
- System.out.println(endTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement