jmrobles / h2go

Apache H2 Go SQL Driver
45 stars 14 forks source link

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

Open johnson-ajar opened 5 months ago

johnson-ajar commented 5 months ago

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

vhlebnikov commented 3 months ago

@johnson-ajar did you solve the issue?