Skip to content

Instantly share code, notes, and snippets.

Created August 29, 2014 12:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
package main
import (
_ ""
func main() {
// Create the database handle, confirm driver is present
db, _ := sql.Open("mysql", "root:password@/4image")
defer db.Close()
// Connect and check the server version
var version string
db.QueryRow("SELECT VERSION()").Scan(&version)
fmt.Println("Connected to:", version)
var name string
db.QueryRow("select cat_name from 4images_categories limit 1").Scan(&name)
fmt.Println("cat name =", name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment