Glorp, PSQL in Pharo 2.0

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Glorp, PSQL in Pharo 2.0

Dennis Schenk
Hi all,

I downloaded a Pharo 2.0 image and wanted to connect my local PostgreSQL database.

For Pharo 1.4 I used

Gofer new 
squeaksource: 'MetacelloRepository';
package: 'ConfigurationOfGlorpDBX';
load.
ConfigurationOfGlorpDBX project latestVersion load: 'GlorpPostgresV2NativeWithTests

and went from there.

First I tried doing the same in Pharo 2.0, but that "ended" in a endless loop.

So I loaded the packages found here: http://smalltalkhub.com/#!/~DBXTalk/Glorp/

I then tried to connect to my database in the following way:

login := Login new
    database: PostgreSQLPlatform new;
    username: 'user';
    password: 'pwd';
    host: 'localhost';
    databaseName: 'db-name'.
accessor := PharoDatabaseAccessor forLogin: login.
accessor login.

But I got an error:

receiver of new is nil 

in:

PharoDatabaseAccessor>>loginIfError: aBlock 
self log: 'Login'.
self databaseDriver: self connectionClass new.
...

Whats would be the correct way to connect and use a psql db from Pharo 2.0?

Cheers,
Dennis

Reply | Threaded
Open this post in threaded view
|

Re: Glorp, PSQL in Pharo 2.0

Sven Van Caekenberghe-2
Hi Dennis,

Yes, it will take a while for all add on packages to stabilize now that 2.0 is out.

I think you need to do something like

        PharoDatabaseAccessor DefaultDriver: NativePostgresDriver.

HTH,

Sven

On 19 Mar 2013, at 20:34, Dennis Schenk <[hidden email]> wrote:

> Hi all,
>
> I downloaded a Pharo 2.0 image and wanted to connect my local PostgreSQL database.
>
> For Pharo 1.4 I used
>
> Gofer new
> squeaksource: 'MetacelloRepository';
> package: 'ConfigurationOfGlorpDBX';
> load.
> ConfigurationOfGlorpDBX project latestVersion load: 'GlorpPostgresV2NativeWithTests
>
> and went from there.
>
> First I tried doing the same in Pharo 2.0, but that "ended" in a endless loop.
>
> So I loaded the packages found here: http://smalltalkhub.com/#!/~DBXTalk/Glorp/
>
> I then tried to connect to my database in the following way:
>
> login := Login new
>     database: PostgreSQLPlatform new;
>     username: 'user';
>     password: 'pwd';
>     host: 'localhost';
>     databaseName: 'db-name'.
> accessor := PharoDatabaseAccessor forLogin: login.
> accessor login.
>
> But I got an error:
>
> receiver of new is nil
>
> in:
>
> PharoDatabaseAccessor>>loginIfError: aBlock
> self log: 'Login'.
> self databaseDriver: self connectionClass new.
> ...
>
> Whats would be the correct way to connect and use a psql db from Pharo 2.0?
>
> Cheers,
> Dennis

--
Sven Van Caekenberghe
http://stfx.eu
Smalltalk is the Red Pill


Reply | Threaded
Open this post in threaded view
|

Re: Glorp, PSQL in Pharo 2.0

Dennis Schenk
Hi Sven,

Thanks for the quick answer. I noticed that I didn't have the NativePostgresDriver class yet in my image. So I loaded PostgresV2 and GlorpDriverPostgreSQL from http://www.squeaksource.com/PostgresV2.

Now the connection works, e.g.:

connArgs := PGConnectionArgs
    hostname: 'localhost'
    portno: 5432
    databaseName: 'db-name'
    userName: 'user'
    password: 'pwd'.
conn := PGConnection new.
conn connectionArgs: connArgs.
conn startup.
...

Thanks again for the hint.

Cheers,
Dennis


On Tue, Mar 19, 2013 at 8:44 PM, Sven Van Caekenberghe <[hidden email]> wrote:
Hi Dennis,

Yes, it will take a while for all add on packages to stabilize now that 2.0 is out.

I think you need to do something like

        PharoDatabaseAccessor DefaultDriver: NativePostgresDriver.

HTH,

Sven

On 19 Mar 2013, at 20:34, Dennis Schenk <[hidden email]> wrote:

> Hi all,
>
> I downloaded a Pharo 2.0 image and wanted to connect my local PostgreSQL database.
>
> For Pharo 1.4 I used
>
> Gofer new
>       squeaksource: 'MetacelloRepository';
>       package: 'ConfigurationOfGlorpDBX';
>       load.
> ConfigurationOfGlorpDBX project latestVersion load: 'GlorpPostgresV2NativeWithTests
>
> and went from there.
>
> First I tried doing the same in Pharo 2.0, but that "ended" in a endless loop.
>
> So I loaded the packages found here: http://smalltalkhub.com/#!/~DBXTalk/Glorp/
>
> I then tried to connect to my database in the following way:
>
> login := Login new
>     database: PostgreSQLPlatform new;
>     username: 'user';
>     password: 'pwd';
>     host: 'localhost';
>     databaseName: 'db-name'.
> accessor := PharoDatabaseAccessor forLogin: login.
> accessor login.
>
> But I got an error:
>
> receiver of new is nil
>
> in:
>
> PharoDatabaseAccessor>>loginIfError: aBlock
>       self log: 'Login'.
>       self databaseDriver: self connectionClass new.
> ...
>
> Whats would be the correct way to connect and use a psql db from Pharo 2.0?
>
> Cheers,
> Dennis

--
Sven Van Caekenberghe
http://stfx.eu
Smalltalk is the Red Pill