Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to connect to Postgresql using sqlex?

76 views
Skip to first unread message

Leonardo

unread,
Dec 29, 2009, 1:53:14 PM12/29/09
to
Hello,
Does anyone have an example how to connect to Postgresql using sqlex?

Ella

unread,
Dec 29, 2009, 7:46:40 PM12/29/09
to

Leonardo,

On Dec 29, 8:53 pm, Leonardo <leonardodemach...@hotmail.com> wrote:
> Hello,
> Does anyone have an example how to connect to Postgresql using sqlex?

Please take a look at:
http://www.xHarbour.com/SQLEX


Ella

Leonardo

unread,
Dec 29, 2009, 9:01:27 PM12/29/09
to

Olá Ella,
I looked around the link and found some example if possible post an
example of how to connect to postgresql using sqlex, from what I've
got to use OBDC, however never used and examples of pulp samples are
very weak.

Leonardo Machado

Ella

unread,
Dec 30, 2009, 9:16:57 AM12/30/09
to
> Olá Ella,

Hola Leonardo,

> I looked around the link and found some example if possible post an
> example of how to connect to postgresql using sqlex, from what I've
> got to use OBDC, however never used and examples of pulp samples are
> very weak.
>
> Leonardo Machado

Personally I've never used PostGres. First you need to find somewhere
an ODBC driver, which works as it should with your PG server and
desktop operating system.

Install the ODBC driver; create a DSN with name let's say Mydsn and
try the test connection to be sure that the software is not broken or
incompatible with your environment ( it can happen ).

In your code try:

REQUEST SQLEX, SR_ODBC
#include "sqlrdd.ch"
......................
cConnString:="DSN=Mydsn;UID=username;PWD=password;DTB=schermename"
.....................
nHandle:=SR_AddConnection( CONNECT_ODBC, cConnString )
.....................


Ella


Leonardo

unread,
Dec 30, 2009, 10:11:57 AM12/30/09
to

Hello Ella,
This part of the install and connect the DSN for him I had already
understood, but I knew I should not install this driver as OBDC in PG,
i came a doubt, I have to do this procedure on all the stations that
are using my system or the server?

Leonardo Machado

Ella

unread,
Dec 30, 2009, 10:46:45 AM12/30/09
to
Leonardo,

> Hello Ella,
> This part of the install and connect the DSN for him I had already
> understood, but I knew I should not install this driver as OBDC in PG,
> i came a doubt, I have to do this procedure on all the stations that
> are using my system or the server?
>

> Leonardo Machado- Ascundeţi textul citat -
>

The PG server can be on Linux machine, Windows machine etc.
The ODBC driver needs to be installed on each and every client machine
(desktop), where your xHarbour executable is used.

Ella

Leonardo

unread,
Dec 30, 2009, 12:14:55 PM12/30/09
to
On 30 dez, 13:46, Ella <ella.st...@xharbour.com> wrote:
> Leonardo,
>
> > Hello Ella,
> > This part of the install and connect the DSN for him I had already
> > understood, but I knew I should not install this driver as OBDC in PG,
> > i came a doubt, I have to do this procedure on all the stations that
> > are using my system or the server?
>
> > Leonardo Machado- Ascundeþi textul citat -

>
> The PG server can be on Linux machine, Windows machine etc.
> The ODBC driver needs to be installed on each and every client machine
> (desktop), where your xHarbour executable is used.
>
> Ella
Hello Ella,
I installed the driver and connecting OBDC, they put me is returning
the following error:

Error SQLRDD/0 SQL execution error at updateRecordBuffer, return
code: -1,
state: 42601, description: ERRO: erro de sintaxe em ou próximo a ",";
Error while executing the query.
Called from ->DBGOTOP(0)
Called from sygecom.prg->ROTINA008(3219)
Called from SAGI.prg->MAIN(154)

This happens when I give a simple DBGOTOP ()
Do you have any hint of what might happening?

Leonardo Machado

Ella

unread,
Dec 30, 2009, 1:44:26 PM12/30/09
to

Leonardo,

Luiz is the PG specialist. In case you want to help him, please post
the following info:


1. xHarbour version and C compiler used by you
2. SQLEX version - or from where and when did you download it
3. PostGres server version
4. ODBC driver - complete name and version
3. How your test table was created? With SQLRDD or what else?
4. COMPLETE reduced source code - how to understand a hidden code?


Ella

Leonardo

unread,
Dec 30, 2009, 4:27:18 PM12/30/09
to

Hello Ella,
1> xHarbour.org 1.2.1 REV(6596) + BCC5.5.1
2> The version sqlex I can not see, but SQLRDD.CH must include the
following:
SQLRDD 8.0 and MGMNT 1.72 help? This lib was purchased in September
2009, according to Marcelo and Luiz already have sqlex.
3>PostgreSQL Version 8.4.1 for Windows and now running smoothly with
the SQLRDD
4>Psqlobdc version 8.0.4.01 for Windows and was downloaded from the
official website of postgresql as link below:
http://wwwmaster.postgresql.org/download/mirrors-ftp/odbc/versions/msi/psqlodbc_08_04_0100.zip
5>It is a table that was created by SQLRDD and already works with
SQLRDD smoothly. With sqlex have to recreate all the tables and
indexes using sqlex?
6>down a code that demonstrates the problem:

***************************
#include "sqlrdd.ch"
#include "pgs.ch" // PARA POSTGRESQL
#include "firebird.ch" // PARA FIREBIRD
#include "mysql.ch" // PARA MYSQL

REQUEST SR_ODBC
REQUEST SQLEX
REQUEST SQLRDD
REQUEST SR_PGS // PARA POSTGRESQL
REQUEST SR_FIREBIRD // PARA FIREBIRD
REQUEST SR_MYSQL // PARA MYSQL

FUNCTION MAIN
Local nCnn:= -1
Local := cAtributes :=
"dsn=mydsn;Server=localhot;Database=teste;Uid=postgres;Pwd=senha;BoolsAsChar=0;"
Local := cDriver := "PostgreSQL ANSI"

If SR_InstallDSN( cDriver, cAtributes )
cConnString := "dsn=mydsn"
nDetected := DetectDBFromDSN( cConnString )

If nDetected > SYSTEMID_UNKNOW
nCnn:= SR_AddConnection( nDetected, cConnString )
EndIf
Else
vERR0=""
For i = 1 to 8
vERR0=vERR0 + SR_InstallError( i ) + HB_OsNewLine()
Next

alert(VALTOPRG(vERR0))

alerto("Não Consegui definir a Conexão OBDC, Favor revisar")
__Quit()
EndIf

If nCnn < 0
alert("Não Conectou ao Banco de Dados, Favor revisar")
__Quit()
ELSE
//RddSetDefault( "SQLRDD" )
RddSetDefault( "SQLEX" )
SR_UseDeleteds( .F. ) // NÃO MANTER REGISTROS DELETADOS NAS
TABELAS
SR_SetFastOpen(.T.) // ABRE AS TABELAS EM MODO COMPARTILHADO
SR_SetGoTopOnScope(.F.) // NÃO EXECUTA O DBGOTOP() AUTOMATICO NOS
ORDSCOPE
SR_MaxRowCache( 100 )
SR_SetBaseLang( 2 )
SR_Msg(2) // portugues
SR_SETSYNTHETICINDEX(.F.) // NÃO SEI POR QUE MAS DEIXA A CRIAÇÃO
DE
INDICE MAIS RAPIDA
SR_SETSYNTHETICINDEXMINIMUN(10)
SR_SetActiveConnection( nCnn )
EndIf

USE AGENDA ALIAS AGENDA SHARED

SELE AGENDA
DBGOTOP() // aqui já da o erro que postei no post anterior // here
since the error I posted in previous post

SR_END()
Return
***************************

Leonardo Machado

Ella

unread,
Dec 30, 2009, 7:56:30 PM12/30/09
to
Leonardo,


> Hello Ella,
> 1> xHarbour.org 1.2.1 REV(6596) + BCC5.5.1
> 2> The version sqlex I can not see, but SQLRDD.CH must include the
> following:
> SQLRDD 8.0 and MGMNT 1.72 help? This lib was purchased in September
> 2009, according to Marcelo and Luiz already have sqlex.
> 3>PostgreSQL Version 8.4.1 for Windows and now running smoothly with
> the SQLRDD

Here:

http://www.xHarbour.com/SQLEX

is specified that SQLEX works ONLY and ONLY with the listed servers
and server versions - your PG 8.4 is NOT on the list.


Ella

Leonardo

unread,
Jan 4, 2010, 6:27:25 AM1/4/10
to

Hi Ella,
Under Luiz Culik said it worked with PostgreSQL 8.4, and now works or
does not work?

Luiz, could you please guide us if it works or does not work with
Postgresql 8.4?

Leonardo Machado

cul...@gmail.com

unread,
Jan 18, 2010, 5:51:49 AM1/18/10
to
Leonardo

please request the last lib with patrick

Problem reported is fixed

Regards
Luiz

Patrick Mast

unread,
Jan 28, 2010, 6:19:51 AM1/28/10
to
Hello,

> please request the last lib with patrick
> Problem reported is fixed

Let me update all SQLRDD LIB's asap.

--
Patrick

0 new messages