Check for database connection

Is it possible to check if the database connection is available after you made the sc_connection_edit() call? I get SQL errors when I connect but I want to give the user a message that it cannot connect to the database it has selected. I wanr to know for sure I am connected to the database. Because if sc_connection_edit() fails I am still connected to the initial database/connection.

Furhtermore I found that you have to make a query to the database in order to fix the sc_connection_edit before changing to another SC application. Can anybody confirm this?

Thansk,
​Ruben