[Newbies] Postgress Database connection
Shawn MacIntyre
smacintyre at mac.com
Tue May 9 17:46:43 UTC 2006
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 at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
--
Shawn MacIntyre
Edmonton, Alberta, Canada
More information about the Beginners
mailing list