Connecting to a PostGreSQL 7.3 database in Python

I need to connect to the old PostGreSQL database (version 7.3) and I am using Python 3.2 on an XP computer. The py-postgresql package seemed appropriate, but it seems to use only the 3.0 protocol, which was implemented in version 7.4. I would like to connect to this database using Python, but when I tried, I received an unexpected EOF error, which, in my opinion, is the result of a package using a newer protocol.

I can use the pgAdminIII program to connect to the database just fine. Any ideas?

+3
source share
2 answers

Unfortunately for you, both py-postgresql and psycopg2 support the v3 protocol.

, - ODBC Postgres pyODBC mxODBC. Python 3.x pyobbc, .

+6

PyGreSQL:

PyGreSQL - Python, PostgreSQL. PostgreSQL PostgreSQL Python script.

PyGreSQL 4.0 PostgreSQL 7.2 Python 2.3 .

EDIT:

PostgreSQL 7.3 ( source Debian Squeeze), , . postgresql.conf, Python:

unix_socket_directory = '/var/run/postgresql'

python-pygresql package ( 4.0.2):

import pg
con1 = pg.connect('postgres', None, 5440, None, None, 'postgres', None)
con1.query('SELECT version()')
version
--------------------------------------------------------------------------------
PostgreSQL 7.3.21 on i686-pc-linux-gnu, compiled by GCC gcc (Debian 4.4.5-8) 4.4
(1 row)
con1.query('SELECT width, height FROM box')
width|height
-----+------
10   |15    
18   |25    
(2 rows)
+3

All Articles