nakagami / firebirdsql

Firebird RDBMS sql driver for Go (golang)
MIT License
220 stars 60 forks source link

Error with Firebird 4.0 #138

Closed krixano closed 2 years ago

krixano commented 2 years ago

I'm trying to use this with firebird 4.0 and am getting an error. It seems the error is happening when I'm trying to do con.Ping() right after doing an sql.Open().

panic: runtime error: slice bounds out of range [:2] with capacity 0

goroutine 1 [running]:
github.com/nakagami/firebirdsql.(*wireProtocol)._parse_connect_response(0x40003be120, {0x40003ba06b, 0x6}, {0x40003ba072, 0xb}, 0x40003ba072?, 0xb?, 0x0?)
        /home/ubuntu/go/pkg/mod/github.com/nakagami/firebirdsql@v0.9.4/wireprotocol.go:508 +0x98c
github.com/nakagami/firebirdsql.newFirebirdsqlConn(0x40003a2050)
        /home/ubuntu/go/pkg/mod/github.com/nakagami/firebirdsql@v0.9.4/connection.go:150 +0x28c
github.com/nakagami/firebirdsql.(*firebirdsqlDriver).Open(0x88?, {0x4000394050?, 0x1000?})
        /home/ubuntu/go/pkg/mod/github.com/nakagami/firebirdsql@v0.9.4/driver.go:39 +0x50
database/sql.dsnConnector.Connect(...)
        /snap/go/9854/src/database/sql/sql.go:761
database/sql.(*DB).conn(0x40003a0680, {0xaefcd8, 0x40000d4048}, 0x1)
        /snap/go/9854/src/database/sql/sql.go:1395 +0x8ec
database/sql.(*DB).PingContext(0x9828d5?, {0xaefcd8, 0x40000d4048})
        /snap/go/9854/src/database/sql/sql.go:853 +0x78
database/sql.(*DB).Ping(...)
        /snap/go/9854/src/database/sql/sql.go:875
github.com/krixano/ponixserver/src/db.NewConn({0x97c0de?, 0x28?})
        /home/ubuntu/server/src/db/db.go:50 +0x52c
github.com/krixano/ponixserver/src/migration.Migrate({0x97c0de, 0x6}, {0x400035fda8?, 0x279654?, 0x0?})
        /home/ubuntu/server/src/migration/migration.go:116 +0x40
github.com/krixano/ponixserver/src/migration.init.0.func1(0x40003a6000?, {0x4000390230?, 0x1?, 0x1?})
        /home/ubuntu/server/src/migration/migration.go:49 +0x2f8
github.com/spf13/cobra.(*Command).execute(0x40003a6000, {0x40003901f0, 0x1, 0x1})
        /home/ubuntu/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x4c4
github.com/spf13/cobra.(*Command).ExecuteC(0x1284a60)
        /home/ubuntu/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x360
github.com/spf13/cobra.(*Command).Execute(...)
        /home/ubuntu/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
main.main()
        /home/ubuntu/server/src/main.go:21 +0x2c
nakagami commented 2 years ago

This does not occur in my environment, but an error occurred here. https://github.com/nakagami/firebirdsql/blob/v0.9.4/wireprotocol.go#L508

Is it failing around authentication negotiation?

nakagami commented 2 years ago

Can you tell me the name and value of the uncommented line in firebird.conf?

krixano commented 2 years ago

There are a few uncommented lines in firebird.conf, so here they are:

RemoteAccess = true
ConnectionIdleTimeout = 60
WireCrypt = Disabled
ServerMode = Super

I also tried with "WireCrypt = Enabled" as well. The server is running on a computer that is directly connected to another server via Ethernet, so encryption wasn't absolutely necessary and in Firebird 3 I found it slowed things down a bit. The connection string has "?wire_crypt=false" at the end of the db path.

krixano commented 2 years ago

Oh, also, I was able to connect to the server "remotely" with FlameRobin and isql, just not with this library.

nakagami commented 2 years ago

Probably fixed tagged with v0.9.5

If you are happy with this, please close the issue

krixano commented 2 years ago

It seems to work now. Thanks!

I did have to use the latest commit's hash with go get to update for some reason, but it ended up working.