Golang database/sql.DB.Ping function example
package database/sql
Ping verifies a connection to the database is still alive, establishing a connection if necessary.
Golang database/sql.DB.Ping function usage example
...
db, err := Open(driverName, dataSourceName)
if err != nil {
return db, err
}
err = db.Ping() // try to ping database server
return db, err
...
Reference :
Advertisement
Something interesting
Tutorials
+30.9k error: trying to remove "yum", which is protected
+14.1k Golang : Check if a file exist or not
+21.4k Curl usage examples with Golang
+11.9k Golang : How to parse plain email text and process email header?
+15.6k Chrome : ERR_INSECURE_RESPONSE and allow Chrome browser to load insecure content
+21.6k Golang : GORM create record or insert new record into database example
+14.5k Golang : Rename directory
+4.5k Java : Generate multiplication table example
+12.1k Golang : Perform sanity checks on filename example
+10.6k Fix ERROR 1045 (28000): Access denied for user 'root'@'ip-address' (using password: YES)
+51.9k Golang : How to get time in milliseconds?