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
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
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
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
> 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
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
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
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
> 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:
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
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
please request the last lib with patrick
Problem reported is fixed
Regards
Luiz
> please request the last lib with patrick
> Problem reported is fixed
Let me update all SQLRDD LIB's asap.
--
Patrick