Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using nzgo/v12 to connect to Netezza 7.2.1 but get v12.(*conn).connNextResultSet 1313 : Unexpected response: 'K' error #55

Open
CC-Hsu opened this issue Jun 6, 2022 · 0 comments

Comments

@CC-Hsu
Copy link

CC-Hsu commented Jun 6, 2022

Hi, Team,

Recently I try to use nzgo to connect Netezza 7.2.1,
but I failed to connect the database.

I use a Netezza test environment obtained from below link.
https://www.ibm.com/support/pages/where-download-ibm-netezza-emulator-software
https://www.ibm.com/docs/en/psfa/7.1.0?topic=overview-virtual-machines

And the environment shows the following version information.

[nz@netezza ~]$ nzsql 
\Welcome to nzsql, the IBM Netezza SQL interactive terminal.

Type:  \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

SYSTEM.ADMIN(ADMIN)=> select version();
            VERSION            
-------------------------------
 Release 7.2.1.0 [Build 46322]
(1 row)

SYSTEM.ADMIN(ADMIN)=> \q
[nz@netezza ~]$ 

My test code is based on the example provided in the doc page

package main

import (
    "database/sql"
    "fmt"
    "log"

    _ "github.com/IBM/nzgo/v12"
)

func main() {
    connStr := "user=admin dbname=system host=192.168.68.54 port=5480 sslmode=verify-full connect_timeout=5"
    db, err := sql.Open("nzgo", connStr)
    if err != nil {
        log.Fatal(err)
        panic(err)
    }
    defer db.Close()

    tst := 321
    rows, err := db.Query("SELECT ?", tst)
    if err != nil {
        log.Fatal(err)
        panic(err)
    }
    fmt.Println(rows)
}

After I compile and execute it (execute the program inside the test Netezza VM shell), the test program does not work and the following driver log is generated.

[nz@netezza ~]$ cat nzgolang_nz46058.log
---------------- IBM PDA Log -----------------
----------------------------------------------
2022-05-31 06:53:57 EST [46058] [INFO] Starting handshake negotiation with server
2022-05-31 06:53:57 EST [46058] [INFO] Handshake negotiation successful
2022-05-31 06:53:57 EST [46058] [INFO] Send handshake information to server
2022-05-31 06:53:57 EST [46058] [INFO] v12.(*conn).Conn_secure_session 3427 : Attempting Unsecured session
2022-05-31 06:53:57 EST [46058] [INFO] Processing query: set nz_encoding to 'utf8'
2022-05-31 06:53:57 EST [46058] [FATAL] v12.(*conn).connNextResultSet 1313 : Unexpected response: 'K'
2022-05-31 06:53:57 EST [46058] [INFO] Connection successful !!
---------------- IBM PDA Log -----------------
----------------------------------------------
2022-05-31 06:53:57 EST [46058] [INFO] Starting handshake negotiation with server
2022-05-31 06:53:57 EST [46058] [INFO] Handshake negotiation successful
2022-05-31 06:53:57 EST [46058] [INFO] Send handshake information to server
2022-05-31 06:53:57 EST [46058] [INFO] v12.(*conn).Conn_secure_session 3427 : Attempting Unsecured session
2022-05-31 06:53:57 EST [46058] [INFO] Processing query: set nz_encoding to 'utf8'
2022-05-31 06:53:57 EST [46058] [FATAL] v12.(*conn).connNextResultSet 1313 : Unexpected response: 'K'
2022-05-31 06:53:57 EST [46058] [INFO] Connection successful !!
---------------- IBM PDA Log -----------------
----------------------------------------------
2022-05-31 06:53:57 EST [46058] [INFO] Starting handshake negotiation with server
2022-05-31 06:53:57 EST [46058] [INFO] Handshake negotiation successful
2022-05-31 06:53:57 EST [46058] [INFO] Send handshake information to server
2022-05-31 06:53:57 EST [46058] [INFO] v12.(*conn).Conn_secure_session 3427 : Attempting Unsecured session
2022-05-31 06:53:57 EST [46058] [INFO] Processing query: set nz_encoding to 'utf8'
2022-05-31 06:53:57 EST [46058] [FATAL] v12.(*conn).connNextResultSet 1313 : Unexpected response: 'K'
2022-05-31 06:53:57 EST [46058] [INFO] Connection successful !!
[nz@netezza ~]$ 

I also find the following error message in /nz/kit/log/postgres/pg.log.

[nz@netezza ~]$ tail -f /nz/kit/log/postgres/pg.log
2022-05-30 05:33:22.248703 EDT [4041]   DEBUG:  readHandshakeClientPacket ssl request=0
2022-05-30 05:33:22.273094 EDT [24479]  DEBUG:  connection: host=192.168.68.54 user=ADMIN database=SYSTEM remotepid=24473 fetype=12
2022-05-30 05:33:22.273170 EDT [24479]  DEBUG:  Session id is 53216
2022-05-30 05:33:22.276464 EDT [24479]  DEBUG:  QUERY: set nz_encoding to 'utf8'
2022-05-30 05:33:22.277013 EDT [24479]  FATAL 1:  Client Terminated Connection exiting
2022-05-30 05:33:22.277306 EDT [24479]  DEBUG:  disconnect: host=192.168.68.54 user=ADMIN database=SYSTEM remotepid=24473 fetype=12
2022-05-30 05:33:22.278404 EDT [4041]   DEBUG:  readHandshakeClientPacket ssl request=0
2022-05-30 05:33:22.303260 EDT [24480]  DEBUG:  connection: host=192.168.68.54 user=ADMIN database=SYSTEM remotepid=24473 fetype=12
2022-05-30 05:33:22.303329 EDT [24480]  DEBUG:  Session id is 53217
2022-05-30 05:33:22.305412 EDT [24480]  DEBUG:  QUERY: set nz_encoding to 'utf8'
2022-05-30 05:33:22.305734 EDT [24480]  FATAL 1:  Client Terminated Connection exiting
2022-05-30 05:33:22.305836 EDT [24480]  DEBUG:  disconnect: host=192.168.68.54 user=ADMIN database=SYSTEM remotepid=24473 fetype=12
2022-05-30 05:33:22.306856 EDT [4041]   DEBUG:  readHandshakeClientPacket ssl request=0
2022-05-30 05:33:22.326671 EDT [24481]  DEBUG:  connection: host=192.168.68.54 user=ADMIN database=SYSTEM remotepid=24473 fetype=12
2022-05-30 05:33:22.326742 EDT [24481]  DEBUG:  Session id is 53218
2022-05-30 05:33:22.329042 EDT [24481]  DEBUG:  QUERY: set nz_encoding to 'utf8'
2022-05-30 05:33:22.329522 EDT [24481]  FATAL 1:  Client Terminated Connection exiting
2022-05-30 05:33:22.329649 EDT [24481]  DEBUG:  disconnect: host=192.168.68.54 user=ADMIN database=SYSTEM remotepid=24473 fetype=12
^C
[nz@netezza ~]$ 

How can I resolve the connection failure issue?

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant