Re: vb6 inquiry - Mailing list pgsql-odbc

From Greg Campbell
Subject Re: vb6 inquiry
Date
Msg-id 4353A033.6070502@us.michelin.com
Whole thread Raw
In response to vb6 inquiry  (Joseph Armbruster <josepharmbruster@gmail.com>)
List pgsql-odbc
I was under the impression that psqlODBC does not support server side cursors. Therefore the correct way
to retrieve data is to use a client side cursor (adUseClient). This is inline with a "disconnected" model
that returns all the requested records immediately, instead of waiting for the client to cursor through
them. This also is supposed to allow a more immediate release of the connection, ultimately providing
greater scalability. (Is scalability still a buzz-word?).

BTW your sample specifies a LockType in two places. It's ok, but you don't really need that. I think the
one on the rs.Open line is good enough.



Note:
adUseServer=2
adUseClient=3


Joseph Armbruster wrote:
> All,
>
> I am working off of the vb6 sample given in the psqlODBC doc that
> accompanies the odbc driver. My issue is, when I am displaying the
> rs.Cursortype, it is reading 3, however this is not what was requested.
> Shouldn't this be 2?
>
> Thank You,
> Joseph Armbruster
>
> Dim cn As New adodb.Connection
> Dim rs As New adodb.Recordset
>
> cn.Open "DSN=test_post;UID=postgres;PWD=acupostgres;Database=vbtest"
>
> rs.CursorType = adOpenDynamic
> rs.LockType = adLockOptimistic
> rs.CursorLocation = adUseServer
> rs.Open "SELECT id, data FROM vbtest", cn, adOpenDynamic, adLockOptimistic
>
> MsgBox "AdoEnums.CursorType.DYNAMIC = " & adodb.CursorTypeEnum.adOpenDynamic
> MsgBox "rs.CursorType = " & rs.CursorType & vbCrLf & "rs.CursorLocation = "
> & rs.CursorLocation
>
> While Not rs.EOF
> Debug.Print rs!id & ": " & rs!Data
> rs.MoveNext
> Wend
>
> rs.AddNew
> rs!id = 76
> rs!Data = "More random data"
>
> rs.Update
>
> cn.Execute "INSERT INTO vbtest (id, data) VALUES (23, 'Some random data');"
> rs.Update
>
>
> If rs.State <> adStateClosed Then rs.Close
> Set rs = Nothing
> If cn.State <> adStateClosed Then cn.Close
> Set cn = Nothing
>

Attachment

pgsql-odbc by date:

Previous
From: "Rainer Hochreiter"
Date:
Subject: Re: unixODBC vs postgeSQL driver on RHEL4?
Next
From: Greg Martin
Date:
Subject: Re: unixODBC vs postgeSQL driver on RHEL4?