how postgreSQL connect
Moderator: Rathinagiri
- dragancesu
- Posts: 921
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
how postgreSQL connect
I see threads on the forum but have not found an answer
I decided to PostgreSQL and now I'm looking for a way to access the HMG
There are examples of harbour and it works, but for example HMG does not work
if someone started c:\hmg.3.3.1\ samples\sql\ postgresql.1\demo.prg?
I decided to PostgreSQL and now I'm looking for a way to access the HMG
There are examples of harbour and it works, but for example HMG does not work
if someone started c:\hmg.3.3.1\ samples\sql\ postgresql.1\demo.prg?
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: how postgreSQL connect
If it works in Harbour, it will work in HMG also.
Have you used HMGSQL library?
Have you used HMGSQL library?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- dragancesu
- Posts: 921
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
Re: how postgreSQL connect
Not yet
I try example from c:\hmg.3.3.1\harbour\conrib\hbppgsql - it's work
An try example from c:\hmg.3.3.1\ samples\sql\ postgresql.1 - don't work
I'll try your suggestion and write impression
I try example from c:\hmg.3.3.1\harbour\conrib\hbppgsql - it's work
An try example from c:\hmg.3.3.1\ samples\sql\ postgresql.1 - don't work
I'll try your suggestion and write impression
- dragancesu
- Posts: 921
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
Re: how postgreSQL connect
HMGSQL is created, exsist \lib\libhmgpgsql.a
Demo program
and result of compilaction
I know that hmgpgsql library must be incude in project, but I don't know how.
I need help
Demo program
Code: Select all
#include "hmg.ch"
Function Main
Local cServer := '127.0.0.1'
Local cDataBase := 'test'
Local cUser := 'scott'
Local cPassWord := 'tiger'
Local dbo := 0
dbo := Connect2DB( cServer, cUser, cPassWord, cDataBase, 5432 )
aTable := SQL(dbo, "SELECT * FROM product ;")
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 800 ;
HEIGHT 510 ;
TITLE 'Hello World!' ;
MAIN
@ 10,10 GRID Grid_1 ;
WIDTH 770 ;
HEIGHT 440 ;
HEADERS { 'Product' , 'Name' , 'Price' } ;
WIDTHS { 100 , 120 , 120 } ;
VALUE { 1 , 1 } ;
ROWSOURCE "aTable"
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return
Code: Select all
Harbour 3.2.0dev (r1312060701)
Copyright (c) 1999-2013, http://harbour-project.org/
d:/Temp/hbmk_y1fddw.dir/demo.o:demo.c:(.data+0x18): undefined reference to `HB_FUN_CONNECT2DB'
d:/Temp/hbmk_y1fddw.dir/demo.o:demo.c:(.data+0x28): undefined reference to `HB_FUN_SQL'
collect2: ld returned 1 exit status
hbmk2[demo]: Error: Running linker. 1
gcc.exe d:/Temp/hbmk_y1fddw.dir/demo.o d:/Temp/hbmk_y1fddw.dir/hbmk_fehnxf.o C:/HARBOUR/hmg/sql/_temp.o -Wl,--nxcompat -Wl,--dynamicbase -mwindows -Wl,--start-group -lhmg -lcrypt -ledit -leditex -lgraph -lini -lreport -lhfcl -lmsvfw32 -lvfw32 -lhbct -lhbwin -lhbmzip -lminizip -lhbmemio -lhbmisc -lhbmysql -lmysql -lhbtip -lhbsqlit3 -lsddodbc -lrddsql -lsddmy -lhbodbc -lodbc32 -lhbhpdf -lhbfimage -lhbpgsql -lhbnetio -lxhb -lpng -llibhpdf -lhbvpdf -lhbzebra -lhbextern -lhbdebug -lhbvmmt -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtwin -lgtwvt -lgtgui -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -lhbhsx -lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon -lhbmainwin -lkernel32 -luser32 -lgdi32 -ladvapi32 -lws2_32 -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lwinmm -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib -Wl,--end-group -ohmgpgsql.exe -LC:/hmg/harbour/lib/win/mingw -LC:/hmg/lib
hbmk2: Error: Referenced, missing, but unknown function(s): CONNECT2DB(), SQL()
I need help
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
how postgreSQL connect
Hi Dragan,dragancesu wrote:I know that hmgpgsql library must be incude in project, but I don't know how.
I need help
I have not much experience with SQL yet. But have you put at initial of your source: REQUEST PGRDD ?
See also this:
viewtopic.php?p=33355#p33355
Did you mean:dragancesu wrote:An try example from c:\hmg.3.3.1\ samples\sql\ postgresql.1 - don't work
Example at C:\hmg.3.3.1\SAMPLES\HFCL\SQL\POSTGRESQL_1
I hope be helped you.
Rgds
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: how postgreSQL connect
libhmgpgsql.a is not pointed by default. So, you have to specify while compiling. That is the problem.
You have to add 'libs=hmgpgsql' in your .hbc file before compiling.
You have to add 'libs=hmgpgsql' in your .hbc file before compiling.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- dragancesu
- Posts: 921
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
Re: how postgreSQL connect
If possible I would ask you to post a simple example
- dragancesu
- Posts: 921
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
Re: how postgreSQL connect
For now I gave up PostgreSQL and I'll try MySQL
I see that the support for MySQL well done and works without problems
I see that the support for MySQL well done and works without problems
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: how postgreSQL connect
Now you have joined my club.
Why don't you try MariaDB, a drop in replacement of MySQL and still developed by the original developers of MySQL after MySQL was taken over by Oracle?
http://mariadb.org
Why don't you try MariaDB, a drop in replacement of MySQL and still developed by the original developers of MySQL after MySQL was taken over by Oracle?
http://mariadb.org
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- AUGE_OHR
- Posts: 2061
- Joined: Sun Aug 25, 2019 3:12 pm
- DBs Used: DBF, PostgreSQL, MySQL, SQLite
- Location: Hamburg, Germany
Re: how postgreSQL connect
hi,
i'm search for quickest Way to transfer DBF into PG-Table
i found some PostgreSQL Sample in HMG.
i got all Sample working but \POSTGRESQL_1 was tricky ...
i add
and reduce it to
now i seems to have access to LIBPQ.DLL API Function
Question : can i use it withOUT PGRDD only API function
i just want to "upsize" DBF to PG-Table so i do not need "navigation" at this step but Speed.
using \DBF2PG.PRG, which seems to use RDD ( oTable:Append( oRecord ) ), i can transfer about 700 Rec/Sec
using \POSTGRESQL_1 Demo i need 29 Sec for 100.000 "INSERT INTO test (...)" so > 3000 /Sec
ok that Sample have only 5 FIELD and no DBF access but i guess it will be better than 700 Rec/Sec
---
i have read about SQLMIX and how Array is used.
--
Sample \POSTGRESQL_1 include GRID ( c:\hmg.3.4.4\SOURCE\h_grid.prg ) which seem to be a WC_LISTVIEW ("SysListView32")
i have Problem with this line
both aCtrl_1 and aCtrl_2 are not declare and i do not know how to use it (does not compile without this line)
p.s. i do not want to "alloweditInplace" just show data
need some help please how to use GRID Syntax
i'm search for quickest Way to transfer DBF into PG-Table
i found some PostgreSQL Sample in HMG.
---c:\hmg.3.4.4\HARBOUR\contrib\hbpgsql\tests\SIMPLE.PRG
c:\hmg.3.4.4\HARBOUR\contrib\hbpgsql\tests\DBF2PG.PRG
c:\hmg.3.4.4\SAMPLES\HFCL\SQL\POSTGRESQL_1\demo.prg
i got all Sample working but \POSTGRESQL_1 was tricky ...
i add
Code: Select all
libs=c:\hmg.3.4.4\HARBOUR\lib\win\mingw\liblibpq.a
Code: Select all
libs=libpq
Question : can i use it withOUT PGRDD only API function
i just want to "upsize" DBF to PG-Table so i do not need "navigation" at this step but Speed.
using \DBF2PG.PRG, which seems to use RDD ( oTable:Append( oRecord ) ), i can transfer about 700 Rec/Sec
using \POSTGRESQL_1 Demo i need 29 Sec for 100.000 "INSERT INTO test (...)" so > 3000 /Sec
ok that Sample have only 5 FIELD and no DBF access but i guess it will be better than 700 Rec/Sec
---
i have read about SQLMIX and how Array is used.
Question : as i know PostgreSQL can only use 1 x FIELD as IndexTo optimize these queries the SQL index expresion should be
"FIELD1,FIELD2,_RECNO", but not "FIELD1,FIELD2" as written in INDEX ON
command.
--
Sample \POSTGRESQL_1 include GRID ( c:\hmg.3.4.4\SOURCE\h_grid.prg ) which seem to be a WC_LISTVIEW ("SysListView32")
i have Problem with this line
Code: Select all
COLUMNCONTROLS { aCtrl_1 , aCtrl_2 } ;
p.s. i do not want to "alloweditInplace" just show data
need some help please how to use GRID Syntax
have fun
Jimmy
Jimmy