Created
January 24, 2019 10:53
-
-
Save noriyukitakei/ca9ff4f618e7c852e62d0c9baea8c4c4 to your computer and use it in GitHub Desktop.
クラウドネイティブなアプリケーションでのデータベース利用について
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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