Validating the Netezza Performance Server Go Driver

Before you try to access a Netezza Performance Server data source using Go application, ensure that the Netezza Performance Server Go Driver installation was successful.


  1. Go client application imports the package Driver name should be "nzgo" as shown in the following example. A simple Go application which connects to the Netezza Performance Server using the Go driver:
    [nz@sim-rh841 app]$ cat sample.go
    package main
    import (
            _ ""
    func main() {
            var connstring string = "user=admin " +
                    "port=5480 " +
                    "password='password' " +
                    "dbname=system " +
                    "host=localhost " +
                    "securityLevel=3 " +
                    "sslmode=require " +
                    "logLevel=info " +
                    //"logPath= /tmp/ +
            db, err := sql.Open("nzgo", connstring)
            if err != nil {
            defer db.Close()
            rows, err := db.Query("select count(*) from _t_object")
            if err != nil {
                    fmt.Println("Error: ", err)
            var count int
            for rows.Next() {
                    _ = rows.Scan(&count)
                    fmt.Println("object count : ", count)
    [nz@sim-rh841 app]$ go run sample.go
    object count :  2803
  2. Compile the application.
    [nz@sim-rh841 app]$ go mod init sample.go
    [nz@sim-rh841 app]$ go get
    [nz@sim-rh841 app]$ go build sample.go
  3. Run the application. The code initializes and loads the nzgo driver by searching for it in $GOPATH/src path. If it's not found in the $GOPATH/src path, the code errors out.
    go run sample.go

    If the application runs successfully, the Performance Server Go Driver was successfully installed.