Hi Esteban,

It’s a mess ;-)

This is what I do (but the code is at least a year old, if not 2 - on the other 
hand, this stuff hardly changes):

T3DatabaseStorageAccessor>>#session
        ^ session ifNil: [
                session := T3StorageDatabaseResource createSession.
                session accessor login.
                session accessor logging: self logSQL.
                session accessor basicExecuteSQLString: 'set timezone to 
''utc'''.
                session ]

T3StorageDatabaseResource class>>#createSession
        ^ T3StorageSchema sessionForLogin: self login

T3StorageDatabaseResource class>>#login
        ^ DatabaseLogin ifNil: [ DatabaseLogin := self defaultLogin ]

T3StorageDatabaseResource class>>#defaultLogin 
        ^(Login new)
                database: PostgreSQLPlatform new;
                username: 't3';
                password: ‘XXXX';
                connectString: 'localhost:5432_t3-storage';
                secure: false;
                yourself 

PharoDatabaseAccessor DefaultDriver is NativePostgresDriver.

Does this help ?

Anyway, other advantages of this driver are that you can go from one machine to 
another, over ssh, double-check with psql, ...

You can even go from your dev machine / image to your production server db 
(over ssh) over the internet …

Regards,

Sven

On 12 Dec 2013, at 13:49, Esteban A. Maringolo <emaring...@gmail.com> wrote:

> 2013/12/12 Sven Van Caekenberghe <s...@stfx.eu>:
>> Maybe a stupid question, but why not use the PostgresV2 ‘native’ driver. 
>> This one is network based, it needs no (annoying) libraries, just a socket 
>> connection ?
>> 
>> And it works perfectly with Glorp.
> 
> I thought I was using it, in fact I load as one of my prerequisites.
> 
> My app only depends on the GlorpSession, which is instantiated as shown 
> before:
> 
> | login accessor session |
> login := Login new
>   database: (PostgreSQLPlatform new characterEncoding: (config at:
> 'encoding' ifAbsent: [ 'utf8' ]));
>   username: (config at: 'username');
>   password: (config at: 'password');
>   connectString: (config at: 'hostname') , '_' , (config at: 'database');
>   encodingStrategy: (DBXStaticEncoding newForEncoding:'utf8').
> 
> accessor := DatabaseAccessor forLogin: login.
> accessor login.
> 
> The DBXStaticEncoding doesn't seem to instantiate any connection
> related classes, but if I remove the line I get the same error.
> 
> But the DefaultDriver of PharoDatabaseAccesor is GlorpOpenDBXDriver,
> which is the only direct subclass of Glorp's DatabaseDriver class. I
> don't know if there is a DatabaseDriver for Glorp that uses the native
> Driver (doesn't seem hard to implement either).
> 
> Now I don't know which path to take. If to properly implement/install
> (repo?) the native DatabaseDriver or configure the required external
> library.
> 
> Regards.
> 


Reply via email to