konstov
konstov

Reputation: 56

Connecting to Firebird on Windows with Python

I already broke my head, where is the problem.

import fdb
con = fdb.connect(host='localhost',
                      database='//soulu.fdb',
                      user='sysdba',
                      password='masterkey',
                      charset='WIN1251'
                      )

And I get this result. Already tried all variants: with charset utf8, win1251: use dsn, use separate host and database parameters. Run script under ubuntu for windows. Nothing helps.

Traceback (most recent call last):
  File "C:\Users\ko-ov\Documents\Albatros\db for upload\loader.py", line 8, in <module>
    charset='WIN1251'
  File "C:\Users\ko-ov\AppData\Local\Programs\Python\Python36-32\lib\site-packages\fdb\fbcore.py", line 734, in connect
    "Error while connecting to database:")
  File "C:\Users\ko-ov\AppData\Local\Programs\Python\Python36-32\lib\site-packages\fdb\fbcore.py", line 560, in exception_from_status
    msglist.append('- ' + (msg.value).decode('utf_8'))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd3 in position 0: invalid continuation byte

Upvotes: 0

Views: 4071

Answers (1)

konstov
konstov

Reputation: 56

I have found the problem (and @MarkRotteveel confirm it by his comment). The solution for me is a update to version 2.5.x from older 2.0.5!

On the official page http://www.firebirdsql.org/en/devel-python-driver/ authors write, that versions 2.0 and later are supported, and theoretically all should works for 2.0.5 without any problem, but not in this case.

May be problem in combination of Win10, python 3.6 and firebird 2.0.5.

Upvotes: 1

Related Questions