Open sashanv opened 11 months ago
I don't have an environment where Firebird 2.1 works, so I can't try it. Maybe Firebird 2.1 does not work.
If the database with a character set other than utf-8, please set the charset parameter. https://github.com/nakagami/firebirdsql#optional
I don't have an environment where Firebird 2.1 works, so I can't try it. Maybe Firebird 2.1 does not work.
If the database with a character set other than utf-8, please set the charset parameter. https://github.com/nakagami/firebirdsql#optional
I got same result,here is my code: package main
import ( "database/sql" "fmt"
_ "github.com/nakagami/firebirdsql"
)
func main() { var n int conn, er := sql.Open("firebirdsql", "SYSDBA:masterkey@localhost:f:\monkey.fdb?charset=utf8") if er != nil { fmt.Println("open failed:", er) return } defer conn.Close() conn.QueryRow("SELECT Count(*) FROM rdb$relations").Scan(&n) fmt.Println("Relations count=", n)
firebirddb 2.5.9,and isql tool: SQL> create database "f:\monkey.fdb" page_size 8192 user 'SYSDBA' password 'masterkey'; Server version: WI-V2.5.9.27139 Firebird 2.5 WI-V2.5.9.27139 Firebird 2.5/XNet (LENOVO)/P12 WI-V2.5.9.27139 Firebird 2.5/XNet (LENOVO)/P12 SQL> SELECT RDB$RELATION_ID FROM RDB$DATABASE;
128
could you take a look what's wrong, and could you provide a sample for windows?
thanks,
\
is escape char, and /
can also be used as a path separator in windows.
Probably, the connection string should be as follows
SYSDBA:masterkey@localhost:f:\\monkey.fdb?charset=utf8
or
SYSDBA:masterkey@localhost:f:/monkey.fdb?charset=utf8
SYSDBA:masterkey@localhost:f:/monkey.fdb?charset=utf8
this still not work, acturally "SYSDBA:masterkey@localhost:f:\monkey.fdb?charset=utf8" is what I used,but it show is "SYSDBA:masterkey@localhost:f:\monkey.fdb?charset=utf8", only one "\", I don't know why.
thanks for your reply, if you could install firebirdsql2.59, or higher version on your windows platform, and test it, then maybe better, support a platform is big deal.
I used double "\\",but it always shows single "\"
Oh, sorry.
Try to follow the pattern of connection strings found at https://github.com/nakagami/firebirdsql/blob/master/utils_test.go#L41-L49
for example
SYSDBA:masterkey@localhost/f:\\monkey.fdb?charset=utf8
or
SYSDBA:masterkey@localhost/f:/monkey.fdb?charset=utf8
SYSDBA:masterkey@localhost/f:\monkey.fdb?charset=utf8
thanks a lot,it works
this works: "SYSDBA:masterkey@localhost/f:\monkey.fdb?charset=utf8" this not works: SYSDBA:masterkey@localhost/f:/monkey.fdb?charset=utf8
thanks I didn't know how it works in windows, so I learned a lot.
thanks I didn't know how it works in windows, so I learned a lot.
SQL> create database "f:\rain.fdb" page_size 8192 user 'SYSDBA' password 'masterkey'; Server version: WI-V3.0.11.33703 Firebird 3.0 SQL> SELECT RDB$RELATION_ID FROM RDB$DATABASE;
128
===================================== package main
import ( "database/sql" "fmt"
_ "github.com/nakagami/firebirdsql"
)
func main() { var n int conn, er := sql.Open("firebirdsql", "SYSDBA:masterkey@localhost/:f:\rain.fdb") if er != nil { fmt.Println("open failed:", er) return } defer conn.Close()
conn.QueryRow("SELECT RDB$RELATION_ID FROM RDB$DATABASE").Scan(&n)
fmt.Println("Relations count=", n)
"SYSDBA:masterkey@localhost/:f:\rain.fdb","\" is double,not single,so this not wrong
thanks I didn't know how it works in windows, so I learned a lot.
We are using Firebird 2.1. Tell me how to read data from it on Go? Through your driver, it turns out to connect to the database and that's it, all requests come back with basically empty answers, although there is data in the database.