Skip to content

Instantly share code, notes, and snippets.

@noriyukitakei
Created January 24, 2019 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noriyukitakei/ca9ff4f618e7c852e62d0c9baea8c4c4 to your computer and use it in GitHub Desktop.
Save noriyukitakei/ca9ff4f618e7c852e62d0c9baea8c4c4 to your computer and use it in GitHub Desktop.
クラウドネイティブなアプリケーションでのデータベース利用について
public class Test {
public static void main(String[] args) {
int LOOP_COUNT = 10000;
long start = System.currentTimeMillis();
try {
for (int i = 0; i < LOOP_COUNT; i++) {
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/hoge", "user", "password");
PreparedStatement pstmt = conn.prepareStatement("SELECT 1");
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
}
rs.close();
pstmt.close();
conn.close();
}
} catch (Exception e) {
e.printStackTrace();
}
long end = System.currentTimeMillis();
System.out.println("time: " + (end - start));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment