Last active
December 28, 2015 00:09
-
-
Save swkwon/7411069 to your computer and use it in GitHub Desktop.
MySql에서는 connection을 Open한 후 wait_timeout이 만료 될때까지 아무런 request가 없으면 DB Server에서 connection을 끊어버립니다.
Application에서는 connection을 사용하기 전에 항상 ping을 날려 상태를 파악한 후 다시 Open해주어야 합니다.
기본 timeout은 28800초 즉, 8시간 입니다.
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
MySqlConnection conn = new MySqlConnection(connStr); | |
conn.Open(); | |
// no job until expired wait_timeout... default timeout is 28800 seconds. | |
conn.Ping(); | |
if (conn.State == System.Data.ConnectionState.Closed) | |
conn.Open(); | |
// Then you can use connection! | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment