Hi again...
I'm triing to connect to a remote postgres db without success...
I've use several framework
***Jim-PostgresSql ***
| client | client := PSQLClient new database: 'sup_prev'; user: 'web'. client establishConnection. client closeConnection.
wich give an unknown message type $# (<- a square - maybe an encoding problem ?? ) aBiteArray(14) in PSQLBackendMessage class>>readFrom: with: ... class := FactoryClassDict at: id ifAbsent: [self error: 'unknown message type ', id printString, ' (', id asInteger printString, ')'
***After, I've tryed PostgresV2*** something like... ( with configuration done on the class side: buildDefaultConnectionArgs )
|conn| conn := PGConnection new. conn . conn startup. conn execute: 'select * from experiences'. conn terminate. ^ resultStream contents. I get an error saying connection not valid - isConnected returning false :s I probably missed something...
***After I tryied to use ODBC but without success too... :s I don't know the dns for postgres...***
Can anyone tell me wich tool(package) to use preferably with postgres ? because I'm a bit lost at the moment :). Also, if you see what are the problems in my connections attempts
Thanks for all
Cédrick
Hi Cédrick,
I'm a newbie too; but I have had success connecting to remote PG72 DBs using Yanni Chiu's postgres client in Squakmap.
Here is some example code that works for me:
PGConnection defaultConnectionArgs userName: '*******'; password: '******'; hostname: 'p-db-002'; databaseName: 'trac'.
| db | Transcript cr; show: 'Connecting to postgres'; cr. db := PGConnection new. (db startup; isConnected) ifTrue: [ | results | results := db execute: 'select firstname, lastname from employee;'. results rows do: [ :row | | data | data := row dataKeyedByFieldName. Transcript show: 'First: ''', (data at: 'firstname') , ''''; cr. Transcript show: 'Last: ''', (data at: 'lastname') , ''''; cr; cr]. db terminate].
I hope this helps. What version of postgres are you running?
Thanks,
On May 9, 2006, at 9:07, cdrick wrote:
Hi again...
I'm triing to connect to a remote postgres db without success...
I've use several framework
[snip]
Can anyone tell me wich tool(package) to use preferably with postgres ? because I'm a bit lost at the moment :). Also, if you see what are the problems in my connections attempts
Thanks for all
Cédrick
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
-- Shawn MacIntyre Edmonton, Alberta, Canada
Hi Shaun :)
I'm a newbie too; but I have had success connecting to remote PG72
DBs using Yanni Chiu's postgres client in Squakmap.
Here is some example code that works for me:
PGConnection defaultConnectionArgs userName: '*******'; password: '******'; hostname: 'p-db-002'; databaseName: 'trac'.
| db | Transcript cr; show: 'Connecting to postgres'; cr. db := PGConnection new. (db startup; isConnected) ifTrue: [ | results | results := db execute: 'select firstname, lastname from employee;'. results rows do: [ :row | | data | data := row dataKeyedByFieldName. Transcript show: 'First: ''', (data at: 'firstname') , ''''; cr. Transcript show: 'Last: ''', (data at: 'lastname') , ''''; cr; cr]. db terminate].
Thanks for your code ;) Actually, I found some problem but that was in the remote database... I had an error message in the write buffer and I got an equivalent from my shell :s
== psql: FATAL: Fichier pg_hba.conf manquant ou erroné == HINT: Voir les traces du serveur pour plus de détails.
pg_hba.conf is missing or with errors ! I'll hope this is only that... It's postgress 7.4.7-6 sarge :)
see you
Cédrick
ps: for odbc, drivers have to be downloaded (from postgres) ...
Cedrick,
You have to add a line in this file pg_hba.conf which is in the data directory of your PostgreSQL installation on your host.
Under
#host all all ::1/128 md5 Add the following
host <your dbname> <your username> <your ip address>/32 MD5
fill in the <..> (remove the <>) with the database user and ipaddress of the person connecting to the remote database.
So for example
ron mydb rondbuser 123.456.789.101/32 MD5
Hope that helps!
Ron Teitelbaum
President / Principal Software Engineer
US Medical Record Specialists
Ron@USMedRec.com
_____
From: beginners-bounces@lists.squeakfoundation.org [mailto:beginners-bounces@lists.squeakfoundation.org] On Behalf Of cdrick Sent: Tuesday, May 09, 2006 1:56 PM To: A friendly place to get answers to even the most basic questions aboutSqueak. Subject: Re: [Newbies] Postgress Database connection
Hi Shaun :)
I'm a newbie too; but I have had success connecting to remote PG72 DBs using Yanni Chiu's postgres client in Squakmap.
Here is some example code that works for me:
PGConnection defaultConnectionArgs userName: '*******'; password: '******'; hostname: 'p-db-002'; databaseName: 'trac'.
| db | Transcript cr; show: 'Connecting to postgres'; cr. db := PGConnection new. (db startup; isConnected) ifTrue: [ | results | results := db execute: 'select firstname, lastname from employee;'. results rows do: [ :row | | data | data := row dataKeyedByFieldName. Transcript show: 'First: ''', (data at: 'firstname') , ''''; cr. Transcript show: 'Last: ''', (data at: 'lastname') , ''''; cr; cr]. db terminate].
Thanks for your code ;) Actually, I found some problem but that was in the remote database... I had an error message in the write buffer and I got an equivalent from my shell :s
== psql: FATAL: Fichier pg_hba.conf manquant ou erroné == HINT: Voir les traces du serveur pour plus de détails.
pg_hba.conf is missing or with errors ! I'll hope this is only that... It's postgress 7.4.7-6 sarge :)
see you
Cédrick
ps: for odbc, drivers have to be downloaded (from postgres) ...
#host all all ::1/128 md5 Add the following
host <your dbname> <your username> <your ip address>/32 MD5
fill in the <..> (remove the <>) with the database user and ipaddress of the person connecting to the remote database.
So for example
ron mydb rondbuser 123.456.789.101/32 MD5
Hope that helps!
Hope too ;)
Anyway thanks Ron I ll see that tomorrow are the guy in chercge of the db is gone !
To use MD5 I need the package you gave me before...?
See you ;)
Cédrick
Hello again cdrick,
I believe you should be using the driver from http://map.squeak.org/package/a8d3ca99-f5f4-45e0-9aa7-100a77b64f45/autoversi on/3
You should also load the cryptography package. You can either load the old one from squeakmap or the newer one from Monticello. If you are loading the newer one use the HTTP repository
MCHttpRepository location: 'http://www.squeaksource.com/Cryptography' user: ' password: ''
You will need a username and password on squeakSource.
Then load the Cryptography-Core, then the Cryptography-MD5 latest versions.
The repository address for the PostgreSQL V2 driver is:
MCHttpRepository location: 'http://www.squeaksource.com/PostgresV2' user: '' password: ''
I have not tried it myself but I know that Giovanni was going to http://lists.squeakfoundation.org/pipermail/squeak-dev/2005-January/087098.h tml so maybe he can help with some pointers?
Also I noticed a package on Google (http://www.google.com/search?hl=en http://www.google.com/search?hl=en&q=postgres+squeak &q=postgres+squeak) http://www.io.com/~jimm/projects/squeak_postgresql/ but I dont know anything about it.
Hope that helps,
Ron Teitelbaum
President / Principal Software Engineer
Really Geeky Guy
US Medical Record Specialists
Ron@USMedRec.com
_____
From: beginners-bounces@lists.squeakfoundation.org [mailto:beginners-bounces@lists.squeakfoundation.org] On Behalf Of cdrick Sent: Tuesday, May 09, 2006 11:08 AM To: A friendly place to get answers to even the most basic questions aboutSqueak. Subject: [Newbies] Postgress Database connection
Hi again...
I'm triing to connect to a remote postgres db without success...
I've use several framework
***Jim-PostgresSql ***
| client | client := PSQLClient new database: 'sup_prev'; user: 'web'. client establishConnection. client closeConnection.
wich give an unknown message type $# (<- a square - maybe an encoding problem ?? ) aBiteArray(14) in PSQLBackendMessage class>>readFrom: with: ... class := FactoryClassDict at: id ifAbsent: [self error: 'unknown message type ', id printString, ' (', id asInteger printString, ')'
***After, I've tryed PostgresV2*** something like... ( with configuration done on the class side: buildDefaultConnectionArgs )
|conn| conn := PGConnection new. conn . conn startup. conn execute: 'select * from experiences'. conn terminate. ^ resultStream contents. I get an error saying connection not valid - isConnected returning false :s I probably missed something...
***After I tryied to use ODBC but without success too... :s I don't know the dns for postgres...***
Can anyone tell me wich tool(package) to use preferably with postgres ? because I'm a bit lost at the moment :). Also, if you see what are the problems in my connections attempts
Thanks for all
Cédrick
I believe you should be using the driver from http://map.squeak.org/package/a8d3ca99-f5f4-45e0-9aa7-100a77b64f45/autoversi...
yep
You should also load the cryptography package. You can either load the old
one from squeakmap or the newer one from Monticello. If you are loading the newer one use the HTTP repository
You will need a username and password on squeakSource.
I have..
Then load the Cryptography-Core, then the Cryptography-MD5 latest versions.
lots of ! thanks for the direction
Squeak rocks ;) see you
Cédrick
Hi ;)
Just to tell you that it was a problem on the server side... the pga_conf file was causing problem beacause of a DynDns or something like that...
sorry then but I hope the discussion was interesting for people wanting to connect a postgres db... it works perfectlyt now...
again
Thanks all ;)
Cédrick
Im glad its working for you!
Ron
_____
From: beginners-bounces@lists.squeakfoundation.org [mailto:beginners-bounces@lists.squeakfoundation.org] On Behalf Of cdrick Sent: Wednesday, May 10, 2006 4:42 AM To: Ron@usmedrec.com; A friendly place to get answers to even the most basic questions aboutSqueak. Subject: Re: [Newbies] Postgress Database connection
Hi ;)
Just to tell you that it was a problem on the server side... the pga_conf file was causing problem beacause of a DynDns or something like that...
sorry then but I hope the discussion was interesting for people wanting to connect a postgres db... it works perfectlyt now...
again
Thanks all ;)
Cédrick
beginners@lists.squeakfoundation.org