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
+9.4k Golang : Create unique title slugs example
+21.3k Golang : Create and resolve(read) symbolic links
+36.4k Golang : Convert date or time stamp from string to time.Time type
+30k Golang : How to declare kilobyte, megabyte, gigabyte, terabyte and so on?
+15.9k Golang : Get current time from the Internet time server(ntp) example
+10.6k RPM : error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
+9.4k Golang : Find the length of big.Int variable example
+6.9k Mac/Linux/Windows : Get CPU information from command line
+4.8k PHP : Extract part of a string starting from the middle
+19.2k Golang : Delete item from slice based on index/key position
+10k Golang : Setting variable value with ldflags
+7.8k Golang : Reverse a string with unicode