From: Gerhard Q. <gq...@sk...> - 2004-12-29 06:36:17
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Use this: c1=PgSQL.connect('host:port:database:user:password:options:tty') basic usage: ~ PgSQL.connect(connect_string) -> connection connect_string ~ ='host:port:database:user:password:options:tty' ~ All parts are optional. You may also pass the information in as ~ keyword arguments with the following keywords: 'host', 'port', ~ 'database', 'user', 'password', 'options', and 'tty'. The port ~ may also be passed in as part of the host keyword parameter, ~ ie. host='localhost:5432'. Other optional parameters are ~ client_encoding and unicode_results. If unicode_results is true, ~ all strings from the backend are returned as Unicode strings. ~ client_encoding accepts the same parameters as the encode method ~ of Unicode strings. If you also want to set a policy for encoding ~ errors, set client_encoding to a tuple, like ("koi8-r", "replace") ~ Note that you still must make sure that the PostgreSQL client is ~ using the same encoding as set with the client_encoding parameter. ~ This is typically done by issuing a "SET CLIENT_ENCODING TO ..." ~ SQL statement immediately after creating the connection. Hector Miuler Malpica Gallegos wrote: | Hello, I have problems with pypgsql, by means of psql I can be | connected to a server with Postgresql=7.3.6, to a data base in which I | have access to everything. | When attempt to connect to me with pypgsql I cannot, with others | librerias for poststoneware if I can, this is the error message: | | =========================================================================== | |>>>from pyPgSQL import PgSQL |>>>c1=PgSQL.connect(user="xxxx", password="xxxxxxx", | | host="serverxxx.xxx", database="xxx") | Traceback (most recent call last): | File "<stdin>", line 1, in ? | File "/usr/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line 2211, | in connect | return Connection(connInfo, client_encoding, unicode_results) | File "/usr/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line 2331, | in __init__ | raise DatabaseError, m | libpq.DatabaseError: Ivalid format for PgVersion construction. | =========================================================================== | | =========================================================================== | |>>>from pyPgSQL import libpq |>>>libpq.PQconnectdb('host=serverxxx.xxx password=xxxxxxx user=xxx dbname=xxxxxxx') | | Traceback (most recent call last): | File "<stdin>", line 1, in ? | ValueError: - -- - ------------------------------------------------------ skequell ------ ~ Gerhard Quell Software & Knowledge Engineering ~ Schützenweg 3 eMail: gq...@sk... Fon: 0731-26400651 ~ 89275 Elchingen web : http://www.skequell.de Fax: 0731-26400652 - --------------- pgp: 473EC53C - http://www.keyserver.net/en--------- -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.3.92 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFB0lBAvHbZD0c+xTwRAhVRAKCp4IbsprzeUmH1I12qSS5PGuanCACgkKnt 2C7sdhdayc5XzgwtTQD3Wew= =6tSF -----END PGP SIGNATURE----- |