Thread: problem ODBC

problem ODBC

From
"frank_lupo"
Date:
I connect to postgresql via ODBC.
---------------
String connection:

        szDns = "SERVER=" & szHost & ";"
        szDns = szDns & "PORT=" & lPort & ";"
        szDns = szDns & "UID=" & szUser & ";"
        szDns = szDns & "PASSWORD=" & szPassword & ";"
        szDns = szDns & "DATABASE=" & szDataBase & ";"
        szDns = szDns & "DRIVER={PostgreSQL};"
        szDns = szDns & "READONLY=0;"
        szDns = szDns & "PROTOCOL=6.4;"
        szDns = szDns & "FAKEOIDINDEX=0;"
        szDns = szDns & "SHOWOIDCOLUMN=0;"
        szDns = szDns & "ROWVERSIONING=0;"
        szDns = szDns & "SHOWSYSTEMTABLES=0;"
        szDns = szDns & "CONNSETTINGS=;"
        szDns = szDns & "FETCH=100;"
        szDns = szDns & "SOCKET=4096;"
        szDns = szDns & "UNKNOWNSIZES=0;"
        szDns = szDns & "MAXVARCHARSIZE=256;"
        szDns = szDns & "MAXLONGVARCHARSIZE=65536;"
        szDns = szDns & "OPTIMIZER=1;"
        szDns = szDns & "KSQO=1;"
        szDns = szDns & "USEDECLAREFETCH=0;"
        szDns = szDns & "TEXTASLONGVARCHAR=1;"
        szDns = szDns & "UNKNOWNSASLONGVARCHAR=1;"
        szDns = szDns & "BOOLSASCHAR=1;"
        szDns = szDns & "PARSE=0;"
        szDns = szDns & "CANCELASFREESTMT=0;"
        szDns = szDns & "EXTRASYSTABLEPREFIXES=dd_;"

        DbCon.Open szDns
---------------

Show datestyle
-> DateStyle is ISO with European conventions
select now()
25/07/2002 9.01.57

Change date style
SET datestyle TO 'SQL' or  SET datestyle TO 'SQL,European'
-> DateStyle is SQL with European conventions
select now()
In Visual Basic error -2147217887

This problem is present also in PgAdmin2.

Help me

Bye !!
Frank Lupo (Wolf) !!



--
Prendi GRATIS l'email universale che... risparmia: http://www.email.it/f

Sponsor:
Partecipa al QX Concorso e vinci ricchi premi!
Iscriviti gratis a QX Service e richiedi un artigiano o un professionista
per vincere fantastici Premi: Lettori Dvd, Micro Hi-fi e Radioregistratori
con CD Philips!
Clicca qui: http://adv2.email.it/cgi-bin/foclick.cgi?mid=540&d=25-7

Re: problem ODBC

From
"Dave Page"
Date:
When does the error occur in pgAdmin?

Regards, Dave.

> -----Original Message-----
> From: frank_lupo [mailto:frank_lupo@email.it]
> Sent: 25 July 2002 10:00
> To: pgadmin-hackers
> Subject: [pgadmin-hackers] problem ODBC
>
>
> I connect to postgresql via ODBC.
> ---------------
> String connection:
>
>         szDns = "SERVER=" & szHost & ";"
>         szDns = szDns & "PORT=" & lPort & ";"
>         szDns = szDns & "UID=" & szUser & ";"
>         szDns = szDns & "PASSWORD=" & szPassword & ";"
>         szDns = szDns & "DATABASE=" & szDataBase & ";"
>         szDns = szDns & "DRIVER={PostgreSQL};"
>         szDns = szDns & "READONLY=0;"
>         szDns = szDns & "PROTOCOL=6.4;"
>         szDns = szDns & "FAKEOIDINDEX=0;"
>         szDns = szDns & "SHOWOIDCOLUMN=0;"
>         szDns = szDns & "ROWVERSIONING=0;"
>         szDns = szDns & "SHOWSYSTEMTABLES=0;"
>         szDns = szDns & "CONNSETTINGS=;"
>         szDns = szDns & "FETCH=100;"
>         szDns = szDns & "SOCKET=4096;"
>         szDns = szDns & "UNKNOWNSIZES=0;"
>         szDns = szDns & "MAXVARCHARSIZE=256;"
>         szDns = szDns & "MAXLONGVARCHARSIZE=65536;"
>         szDns = szDns & "OPTIMIZER=1;"
>         szDns = szDns & "KSQO=1;"
>         szDns = szDns & "USEDECLAREFETCH=0;"
>         szDns = szDns & "TEXTASLONGVARCHAR=1;"
>         szDns = szDns & "UNKNOWNSASLONGVARCHAR=1;"
>         szDns = szDns & "BOOLSASCHAR=1;"
>         szDns = szDns & "PARSE=0;"
>         szDns = szDns & "CANCELASFREESTMT=0;"
>         szDns = szDns & "EXTRASYSTABLEPREFIXES=dd_;"
>
>         DbCon.Open szDns
> ---------------
>
> Show datestyle
> -> DateStyle is ISO with European conventions
> select now()
> 25/07/2002 9.01.57
>
> Change date style
> SET datestyle TO 'SQL' or  SET datestyle TO 'SQL,European'
> -> DateStyle is SQL with European conventions
> select now()
> In Visual Basic error -2147217887
>
> This problem is present also in PgAdmin2.
>
> Help me
>
> Bye !!
> Frank Lupo (Wolf) !!
>
>
>
> --
> Prendi GRATIS l'email universale che... risparmia:
http://www.email.it/f

Sponsor:
Partecipa al QX Concorso e vinci ricchi premi!
Iscriviti gratis a QX Service e richiedi un artigiano o un
professionista per vincere fantastici Premi: Lettori Dvd, Micro Hi-fi e
Radioregistratori con CD Philips! Clicca qui:
http://adv2.email.it/cgi-bin/foclick.cgi?mid=540&d=25-7

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Re: problem ODBC

From
"frank_lupo"
Date:
> When does the error occur in pgAdmin?
>
> Regards, Dave.
>
> > -----Original Message-----
> > From: frank_lupo [mailto:frank_lupo@email.it]
> > Sent: 25 July 2002 10:00
> > To: pgadmin-hackers
> > Subject: [pgadmin-hackers] problem ODBC
> >
> >
> > I connect to postgresql via ODBC.
> > ---------------
> > String connection:
> >
> >         szDns = "SERVER=" & szHost & ";"
> >         szDns = szDns & "PORT=" & lPort & ";"
> >         szDns = szDns & "UID=" & szUser & ";"
> >         szDns = szDns & "PASSWORD=" & szPassword & ";"
> >         szDns = szDns & "DATABASE=" & szDataBase & ";"
> >         szDns = szDns & "DRIVER={PostgreSQL};"
> >         szDns = szDns & "READONLY=0;"
> >         szDns = szDns & "PROTOCOL=6.4;"
> >         szDns = szDns & "FAKEOIDINDEX=0;"
> >         szDns = szDns & "SHOWOIDCOLUMN=0;"
> >         szDns = szDns & "ROWVERSIONING=0;"
> >         szDns = szDns & "SHOWSYSTEMTABLES=0;"
> >         szDns = szDns & "CONNSETTINGS=;"
> >         szDns = szDns & "FETCH=100;"
> >         szDns = szDns & "SOCKET=4096;"
> >         szDns = szDns & "UNKNOWNSIZES=0;"
> >         szDns = szDns & "MAXVARCHARSIZE=256;"
> >         szDns = szDns & "MAXLONGVARCHARSIZE=65536;"
> >         szDns = szDns & "OPTIMIZER=1;"
> >         szDns = szDns & "KSQO=1;"
> >         szDns = szDns & "USEDECLAREFETCH=0;"
> >         szDns = szDns & "TEXTASLONGVARCHAR=1;"
> >         szDns = szDns & "UNKNOWNSASLONGVARCHAR=1;"
> >         szDns = szDns & "BOOLSASCHAR=1;"
> >         szDns = szDns & "PARSE=0;"
> >         szDns = szDns & "CANCELASFREESTMT=0;"
> >         szDns = szDns & "EXTRASYSTABLEPREFIXES=dd_;"
> >
> >         DbCon.Open szDns
> > ---------------
> >
> > Show datestyle
> > -> DateStyle is ISO with European conventions
> > select now()
> > 25/07/2002 9.01.57
> >
> > Change date style
> > SET datestyle TO 'SQL' or  SET datestyle TO 'SQL,European'
> > -> DateStyle is SQL with European conventions
> > select now()
> > In Visual Basic error -2147217887
> >
> > This problem is present also in PgAdmin2.
> >
> > Help me
> >
> > Bye !!
> > Frank Lupo (Wolf) !!
> >
> >
> >
> > --
> > Prendi GRATIS l'email universale che... risparmia:
> http://www.email.it/f
>
> Sponsor:
> Partecipa al QX Concorso e vinci ricchi premi!
> Iscriviti gratis a QX Service e richiedi un artigiano o un
> professionista per vincere fantastici Premi: Lettori Dvd, Micro Hi-fi
e
> Radioregistratori con CD Philips! Clicca qui:
> http://adv2.email.it/cgi-bin/foclick.cgi?mid=540&d=25-7
>
> ---------------------------(end of broadcast)-------------------------
--
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
> ---------------------------(end of broadcast)-------------------------
--
> TIP 4: Don't 'kill -9' the postmaster
>

The error occurs in window sql interactive.
Try to insert in sequence the instructions listed in my previous
message.



Bye !!
Frank Lupo (Wolf) !!



--
Prendi GRATIS l'email universale che... risparmia: http://www.email.it/f

Sponsor:
Non sai cosa regalare? Vai su Artefiori, il Portale del Verde!
clicca qui:
Clicca qui: http://adv2.email.it/cgi-bin/foclick.cgi?mid=548&d=25-7

Re: problem ODBC

From
"Dave Page"
Date:

> -----Original Message-----
> From: frank_lupo [mailto:frank_lupo@email.it]
> Sent: 25 July 2002 10:12
> To: Dave Page
> Cc: pgadmin-hackers@postgresql.org
> Subject: Re: [pgadmin-hackers] problem ODBC
>
>
> > >
> > > Show datestyle
> > > -> DateStyle is ISO with European conventions
> > > select now()
> > > 25/07/2002 9.01.57
> > >
> > > Change date style
> > > SET datestyle TO 'SQL' or  SET datestyle TO 'SQL,European'
> > > -> DateStyle is SQL with European conventions
> > > select now()
> > > In Visual Basic error -2147217887
> > >
> > > This problem is present also in PgAdmin2.
> > >
> > > Help me
> > >
> > When does the error occur in pgAdmin?
>
> The error occurs in window sql interactive.
> Try to insert in sequence the instructions listed in my previous
> message.

Ahh yes. I would expect that to happen. VB tries to interpret the dates
rather than handle them as text strings. The most reliable way of doing
this is to use ISO format - other formats may not be recognised by VB. I
always suggest people use ISO formatted dates on the server and to let
the client application reformat them to the local style as required.
E.g.

Text1.Text = Format(rs!datefield, "Long Date")

Regards, Dave.