Omnis PostgreSQL - Windows connection problem
Andy Hilton
andyh at totallybrilliant.com
Tue Dec 10 15:00:21 EST 2013
Yeah beats me why windows but that has been a long running question :)
Let's say you have a session object called ioSessionObjRef - you can do things like this (we use this essentially before *every* call we make) :
If ioSessionObjRef.$state.$cando
Do ioSessionObjRef.$state() Returns SessionState
If SessionState=kSessionStateLoggedOff
; OK message @DEBUG {You will need to reopen your application.}
; do what you need to do in this event
Else If SessionState=kSessionStateLoggedOn
; Test PostgreSQL a little further to make sure we really are connected.
Do ioSessionObjRef.$connectstatus() Returns ConnectStatus
If ConnectStatus<>kPgSqlConnectionOK
; check the error here before trying a reconnect - are we in the middle of a transaction ? If so give up and tell user to start again
Calculate SessionState as kSessionStateLoggedOff
Do $cinst.$reconnectSession() Returns FlagOK
If ioSessionObjRef.$state.$cando
Do ioSessionObjRef.$state() Returns SessionState
If SessionState=kSessionStateLoggedOff
; OK message @DEBUG {You will need to reopen your application.}
; do what you need to do in this event
End If
End If
End If
End If
End If
Where the method : $reconnectSession consists of :
Calculate FlagOK as kTrue ;; Default true.
Calculate TransactionModeBegin as kSessionTranAutomatic ;; Default automatic
If ioSessionObjRef.$validref
; We have a valid session object.
Do ioSessionObjRef.$reset()
If ioSessionObjRef.$state=kSessionStateLoggedOn
Quit method kTrue
End If
; When reconnecting be sure that the $transactionmode does not get changed.
If ioSessionObjRef.$transactionmode.$cando
Do ioSessionObjRef.$transactionmode() Returns TransactionModeBegin
End If
Else
Calculate FlagOK as kFalse ;; added 2013-03-30 to prevent timers reconnecting if a user has logged out - potential security flaw
End If
Quit method FlagOK
As you will see the crux of all of this is calling the line :
Do ioSessionObjRef.$reset()
Try variations of the above (I have hastily pulled this out of my base classes so is not verbatim but hacked to fit so not guaranteed !!)
Andy
On Dec 10, 2013, at 2:41 PM, Bob Fiering <bob at maxolution.nl> wrote:
> Hi Andy,
>
> Thanks for responding.
>
> The database is 'in the cloud' on an dedicated server in a datacenter.
> Omnis application is Fat Client based so no javascript. PC's have their own Omnis Studio installation and library.
>
> What should be the best way to reconnect.
> I saw several possible solutions on the list archive.
> Most strange thing is that the same application on Apple and Windows mixed surrounding is running smoothly on a same kind of server.
>
>
> Bob
>
>
>
> Op 10 dec. 2013, om 20:31 heeft Andy Hilton <andyh at totallybrilliant.com> het volgende geschreven:
>
> Bob
>
> Is the server part of the customers local network or a remote (cloud like) server ?
>
> I added code in to my app which auto reconnects if the connection is lost - and that may actually resolve your issue if it is that they are just 'blips' in the connection....
>
> As you know with most database type connections, they typically go for 'permanent' connections - and if the connection is - for whatever reason - broken, that of course does not affect or show in any browser like situation - but will definitely cause a kerfuffle in an app like Omnis....but there are ways around it !!
>
> If you think this sounds like your issue let me know and I'll post the relevant code......
>
> Andy
>
> On Dec 10, 2013, at 2:20 PM, Bob Fiering <bob at maxolution.nl> wrote:
>
>> We have a customer who is starting with our product and is having a lot of difficulties with the connection.
>> Several times a day the connection is lost, where the internet connection is not lost.
>> Only the connection to the database is lost.
>>
>> When i connect with my mac to the same server everything is fine. No problems.
>>
>> Their network manager looked at things like sleep mode, ethernet settings and so on, but on their clients it seems ok.
>>
>> As a last effort i switched of SSL and made changes to the pg_hba config file to see if tomorrow when they start working again the problem is solved.
>>
>> PostgreSQL is version 9.3 and is running as a cluster on an Ubuntu 12.04 LTS server.
>> Omnis is 5.2.3.
>>
>> Any help what so ever would be very appreciated.
>>
>>
>> Bob_____________________________________________________________
>> Manage your list subscriptions at http://lists.omnis-dev.com
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
More information about the omnisdev-en
mailing list