How to determine connection state of Perl DBI database handler(is connection opend)? Something like .NET SqlConnection.State == Open. May be something like
defined($dbh->do("some nop sql"))
but can’t find sql nop statement to use.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can ask you database handle if it is connected by calling
Some DB Drivers don’t implement
pingbut DBD::mysql does. An alternative is to run an empty select likeselect 1for MySQL. I’m assuming MySQL since that is how your question is tagged. Other databases will have slightly different answers.