-
Notifications
You must be signed in to change notification settings - Fork 55
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
db.Query with NULL *LOB fields hangs #18
Comments
Ok - as the error clearly states, that the table cannot be found in schema SYSTEM:
Please share the results after the change - thanks! ...Thanks for writing the go-hdb library!! |
Didn't hear back, so closing the issue |
I also observe that the process hangs when trying to fetch a LOB with a value of create schema test;
create table test.table_1 (col clob not null);
insert into test.table_1 values('some-text');
create table test.table_2 (col clob);
insert into test.table_2 values(null); package main
import (
"bytes"
"database/sql"
"fmt"
"github.com/SAP/go-hdb/driver"
)
func main() {
db, err := sql.Open("hdb", "hdb://<user>:<password>@<host>:<port>")
if err != nil {
panic(err)
}
defer db.Close()
fetchLob(db, "non-null", "table_1")
fetchLob(db, "null", "table_2")
}
func fetchLob(db *sql.DB, scenario string, tableName string) {
fmt.Printf("Fetching %s LOB value ...\n", scenario)
lob := new(driver.Lob)
b := new(bytes.Buffer)
lob.SetWriter(b)
if err := db.QueryRow(fmt.Sprintf("select col from test.%s", tableName)).Scan(lob); err != nil {
panic(err)
}
fmt.Printf("Fetched value: %v\n\n\n", b)
} The output is:
There is no value from the second fetch because the process hangs. Let me know if there is anything wrong in my coding or this is an issue in the library. Many thanks |
thanks a lot for providing the example - the code looks good, so most probably we are going to provide a fix asap |
should work with the newest release (v0.11.1) - please see new NullLob for scanning Lob null values |
Works as expected now, thanks a lot |
In our HANA2 database we have a Column table with several NCLOB fields, some of them allow NULL data and when running a query with go-hdb
Query("SELECT POTENTIALLY_NULL FROM A_TABLE")
the program hangs for close to 5 minutes before erroring out with the followingI am explicitly setting the SCHEMA to the correct value and the included code works fine if the field I select is NOT NULL.
The JDBC driver handles this with no issues.
I have ran WireShark and it seems that using the go-hdb driver the packets just stop flowing.
Go Version:
go version go1.9.3 darwin/amd64
go-hdb Version:
const DriverVersion = "0.9.5"
Thanks for writing the go-hdb library!!
The text was updated successfully, but these errors were encountered: