There is a file in .FDB format .FDB I am writing a script that could read it and change some data.

 import pyodbc query = "SELECT CURTIME();" datab='driver={MySQL ODBC 3.51 Driver};server=localhost;database=PTKAZS.FDB;uid=login;pwd=password' conn = pyodbc.connect(datab) cursor = conn.cursor() cursor.execute(query) row = cursor.fetchall() print(row) 

But when starting, it gives an error: Traceback (most recent call last): File "connect_db_1.py", line 8, in <module> conn = pyodbc.connect(datab) pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'MySQL ODBC 3.51 Driver' : file not found (0) (SQLDriverConnect)")

  • If I understand correctly - FDB is Firebird DB, which has nothing in common (except that it is also relational) with MySQL DB. - MaxU
  • Try the fdb module ... - MaxU
  • Thank you very much! - Milkiweed Gtlt

1 answer 1

Here are examples from the fdb module tutorial :

 import fdb con = fdb.connect(dsn='/temp/test.db', user='sysdba', password='masterkey') # Create a Cursor object that operates in the context of Connection con: cur = con.cursor() # Execute the SELECT statement: cur.execute("select * from languages order by year_released") # Retrieve all rows as a sequence and print that sequence: print cur.fetchall() 

 # Example 4: Let's insert more languages: newLanguages = [ ('Lisp', 1958), ('Dylan', 1995), ] cur.executemany("insert into languages (name, year_released) values (?, ?)", newLanguages ) # The changes will not be saved unless the transaction is committed explicitly: con.commit()