RAD Studio 10.4.1 is now available! Learn more. Looking for discounts? Visit our Special Offers page!
News

InterBase and Python

Author: Gabe Goldfield

 

Install PyDev using the Eclipse IDE

The instructions for installing PyDev are here:
http://www.pydev.org/manual_101_install.html

In the Eclipse IDE I chose Help > Install Updates and Entered the URL for PyDev

1

Install Python3.4

I chose the Windows x86 .msi installer from here
https://www.python.org/downloads/release/python-342/ and installed to C:Python34_2

Configure Eclipse to use Python

In Eclipse select Windows>Preferences

Under the Pydev tree, select PyDev> Interpreters> Python Interpreter

Click New and set the Python Interpreter name and executable to the previously install Python

2

 

 

Download the FDB 1.4.9 driver sources

The sources are available here
https://pypi.python.org/pypi/fdb

I extracted the sources to
C:fdb-1.4.9

Edit the sources to use the InterBase client library gds32.dll instead of the FireBird default library

There were 2 files that needed to be changed to work with Embarcadero InterBase XE7 instead of the Default FireBrid server.

Ibase.py
Starting at line 1163

Original

New

 

Starting at line 1479

Original

New

 

Fbcore.py

Starting at line 542

Original

New

 

Starting at line 923

Original

New

 

Starting at 1343

Original

New

 

Install the driver to your local Python Environment

After making the changes to ibase.py and fbcore.py, you are now ready to install the driver to your Python Environment.

From the commandline navigate to the fdb1.4.9 directory.
C:fdb-1.4.9>python.exe setup.py install

After installed you should see the message
Installed c:python34_2libsite-packagesfdb-1.4.9-py3.4.egg
Processing dependencies for fdb==1.4.9
Finished processing dependencies for fdb==1.4.9

Write a simple test to connect to InterBase in Eclipse

In Eclipse select file > new > project > PyDev > PyDev project

3

4

More complete instructions can be found here
http://www.pydev.org/manual_101_project_conf.html

After creating a blank Python module, I added this code.

 

This is all the code needed to import the driver, create a connection, create a cursor, select the data, and print the result.

After adding this code to a blank Python Module, select the Module > Run As > Python Run.

5

 


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Related posts
C++CodeDelphi

Learn To Build A Python GUI For Solving Complex Tasks With Powerful OpenCV Library In A Delphi Windows App

C++CodeDelphi

Learn To Build A Python GUI For Working With The Numpy Library In A Delphi Windows App

DatabaseInterBaseRAD Studio

Learn How To Connecing To Local InterBase Instances In This Video

InterBaseNewsRAD Studio

Migrating from BDE/Paradox to InterBase

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES