1 22 23 package org.apache.derbyTesting.functionTests.tests.perf; 24 25 import org.apache.derbyTesting.functionTests.util.JarUtil; 26 import org.apache.derbyTesting.junit.BaseJDBCTestCase; 27 28 import java.sql.*; 29 30 38 public class StartupExistingDBTest extends BaseJDBCTestCase { 39 public StartupExistingDBTest(String name) { 40 super(name); 41 } 42 43 44 45 public void testExistingDB() throws Exception { 46 JarUtil.unjar("existingDb.jar", null); 47 48 long startTime = System.currentTimeMillis(); 49 System.out.println("Testing startup with an EXISTING database... " + 50 "All measurements are in milliseconds."); 51 52 Class driver = Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); 54 long currentTime = System.currentTimeMillis(); 55 System.out.println("Loading driver: " + (currentTime - startTime)); 56 57 startTime = System.currentTimeMillis(); 59 Connection conn = 60 DriverManager.getConnection("jdbc:derby:../existingDb"); 61 currentTime = System.currentTimeMillis(); 62 System.out.println("Open connection with existing database: " 63 + (currentTime - startTime)); 64 65 startTime = System.currentTimeMillis(); 67 Statement stmt = conn.createStatement(); 68 stmt.execute("CREATE TABLE test_table(id integer primary key, " + 69 "last_name varchar(80), first_name varchar(80), " + 70 "mi char(1), address varchar(100), city varchar(80))"); 71 currentTime = System.currentTimeMillis(); 72 System.out.println("Creating a table: " 73 + (currentTime - startTime)); 74 } 75 } 76 | Popular Tags |