Skip to content

Bad connection issue when mem=false and when calling the conn.Ping() #5

@johnson-ajar

Description

@johnson-ajar

Hi,

I tried connecting to the h2 database after running
java -cp h2*.jar org.h2.tools.Server -tcp -tcpAllowOthers -ifNotExists -trace -trace -baseDir ./tempData

When I try to open a connection its successful
conn, err := sql.Open("h2", "h2://sa@localhost:9092/testdb1?mem=false&logging=info")

When I try conn.Ping() get the following error.

@line 50 in conn.go get the error SQL Error: Unknown which is then returned as
driver: bad connection

Commented the Ping() call and execute the following sql query.
ret, err := conn.Exec("CREATE TABLE test (id int not null, name varchar(100));")
get the following error.
Can't execute sentence: SQL Error: unknown: Can't read all data needed.

I would like to connect to h2 database, where the database is created in a data folder, instead of memory.
I checked out all the examples and they all seems to work only for in memory database.

Please can you suggest me how to fix this issue.

thanks
Johnson

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions