If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Python to access Postgres (pygresql)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-05-07, 19:51
opelcorsa opelcorsa is offline
Registered User
 
Join Date: Jan 2006
Posts: 26
Python to access Postgres (pygresql)

Can someone please let me know how I can connect to an external PG database through Python? (using pygresql or any other library -please specify which lib you use). I am at total loss; there's no useful tutorial on how to do this! There's only one example on the whole 'net (the bike rider club) which is not helpful.

I just need that small piece of code that would let me connect to, say, sql.abc.net with username 'bob' and password '123' and dbname='mydb'.

I already have installed the client version of PG 8.2. Haven't made any changes to the .conf files.

I really appreciate any help.

P.S> I have already tried something like:
Code:
import pg
con1=pg.connect(dbname='mydb', host='sql.abc.net', user='bob', passwd='123')
which gives me
Quote:
InternalError: FATAL: no pg_hba.conf entry for host "12.34.56.78", ...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On