Skip to content

Instantly share code, notes, and snippets.

@jmrobles
Created November 14, 2020 23:36
Show Gist options
  • Save jmrobles/e33a9798d44ba4651045fa64b2ee5e53 to your computer and use it in GitHub Desktop.
Save jmrobles/e33a9798d44ba4651045fa64b2ee5e53 to your computer and use it in GitHub Desktop.
package main
import (
"database/sql"
"log"
_ "github.com/jmrobles/h2go"
)
func main() {
conn, err := sql.Open("h2", "h2://sa@localhost/testdb?mem=true")
if err != nil {
log.Fatalf("Can't connet to H2 Database: %s", err)
}
err = conn.Ping()
if err != nil {
log.Fatalf("Can't ping to H2 Database: %s", err)
}
log.Printf("H2 Database connected")
conn.Close()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment