Thread: Ii can't connect to postgresql with VFP 8
I want to try postgresql with VFP 8 sp1, but i can't connect to new created database. I've installed pq + odbc driver. With pgAdminIII,I can connect to my database using password '123456' and default user 'postgres',default port 5432 ,but with VFP i can't.Connection is a local one This is the code I use (it always gives me 'Couldn't connect to the database!') : Local lnConn lnConn = SQLSTRINGCONNECT([Driver={PostgreSQL};Server=127.0.0.1;Port=5432;Database=persoane;Uid=postgres;Pwd=123456]) If lnConn < 0 MessageBox( "Couldn't connect to the database !" ) ELSE MessageBox( "OK !" ) =SQLDisconnect( lnConn ) Endif Thanks ! _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
I'm looking for some examples VFP with Postgresql ? thanks. _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Try : lnConn = SQLSTRINGCONNECT([Driver={PostgreSQL Unicode};Server=127.0.0.1;Port=5432;Database=persoane;Uid=postgres;Pwd=123456]) Hope this helps ionut ichim wrote: > I want to try postgresql with VFP 8 sp1, but i can't connect to new > created database. > I've installed pq + odbc driver. With pgAdminIII,I can connect to my > database using password '123456' and default user 'postgres',default > port 5432 ,but with VFP i can't.Connection is a local one > This is the code I use (it always gives me 'Couldn't connect to the > database!') : > > > Local lnConn > lnConn = > SQLSTRINGCONNECT([Driver={PostgreSQL};Server=127.0.0.1;Port=5432;Database=persoane;Uid=postgres;Pwd=123456]) > > If lnConn < 0 > MessageBox( "Couldn't connect to the database !" ) > ELSE > MessageBox( "OK !" ) > =SQLDisconnect( lnConn ) > > Endif > > Thanks ! > > _________________________________________________________________ > Express yourself instantly with MSN Messenger! Download today it's > FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > > -- Luiz K. Matsumura Plan IT Tecnologia Informática Ltda.
2007/3/7, ionut ichim <ionutichim@hotmail.com>: > I'm looking for some examples VFP with Postgresql ? > thanks. I'm using vfp with postgresql, what kind of examples? Alejandro
Thanks for answer. I'm interest how can i work with pg +VFP ... connections,sored procedures,backup ,etc Some links for simple examples, to test. >From: "Alejandro D. Burne" <alejandro.dburne@gmail.com> >To: pgsql-odbc@postgresql.org >Subject: Re: [ODBC] examples VFP with Postgresql >Date: Thu, 8 Mar 2007 09:26:10 -0300 > >2007/3/7, ionut ichim <ionutichim@hotmail.com>: >>I'm looking for some examples VFP with Postgresql ? >>thanks. > >I'm using vfp with postgresql, what kind of examples? > >Alejandro > >---------------------------(end of broadcast)--------------------------- >TIP 1: 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 _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
2007/3/8, ionut ichim <ionutichim@hotmail.com>: > Thanks for answer. > I'm interest how can i work with pg +VFP ... connections,sored > procedures,backup ,etc > Some links for simple examples, to test. First at all I'm using sqlpassthrough: a.Create connection: _Conn=SQLCONNECT('<ODBC Conn>','<user>','<pwd>') b.Run sql statement lResult=SQLEXEC(_Conn,"SELECT field1, field2... FROM table","<cursor_name>") IF lResult>0 * all goes fine ELSE MESSAGEBOX(MESSAGE()) ENDIF c.Disconnect lResult=SQLDISCONNECT(_Conn) Stores procedures, functions is like any other sql statement using psql. Backups -> RTFunnyM Alejandro
ok.. thanks a lot >From: "Alejandro D. Burne" <alejandro.dburne@gmail.com> >To: pgsql-odbc@postgresql.org >Subject: Re: [ODBC] examples VFP with Postgresql >Date: Thu, 8 Mar 2007 10:23:48 -0300 > >2007/3/8, ionut ichim <ionutichim@hotmail.com>: >>Thanks for answer. >>I'm interest how can i work with pg +VFP ... connections,sored >>procedures,backup ,etc >> Some links for simple examples, to test. > >First at all I'm using sqlpassthrough: > >a.Create connection: >_Conn=SQLCONNECT('<ODBC Conn>','<user>','<pwd>') > >b.Run sql statement >lResult=SQLEXEC(_Conn,"SELECT field1, field2... FROM >table","<cursor_name>") >IF lResult>0 > * all goes fine >ELSE > MESSAGEBOX(MESSAGE()) >ENDIF > >c.Disconnect >lResult=SQLDISCONNECT(_Conn) > >Stores procedures, functions is like any other sql statement using psql. >Backups -> RTFunnyM > >Alejandro > >---------------------------(end of broadcast)--------------------------- >TIP 5: don't forget to increase your free space map settings _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
ok..i'll try it. Thanks very much! >From: "Luiz K. Matsumura" <luiz@planit.com.br> >To: ionut ichim <ionutichim@hotmail.com> >CC: pgsql-odbc@postgresql.org >Subject: Re: [ODBC] Ii can't connect to postgresql with VFP 8 >Date: Wed, 07 Mar 2007 23:31:00 -0300 > >Try : > >lnConn = SQLSTRINGCONNECT([Driver={PostgreSQL >Unicode};Server=127.0.0.1;Port=5432;Database=persoane;Uid=postgres;Pwd=123456]) > > >Hope this helps > > >ionut ichim wrote: >>I want to try postgresql with VFP 8 sp1, but i can't connect to new >>created database. >>I've installed pq + odbc driver. With pgAdminIII,I can connect to my >>database using password '123456' and default user 'postgres',default port >>5432 ,but with VFP i can't.Connection is a local one >>This is the code I use (it always gives me 'Couldn't connect to the >>database!') : >> >> >>Local lnConn >>lnConn = >>SQLSTRINGCONNECT([Driver={PostgreSQL};Server=127.0.0.1;Port=5432;Database=persoane;Uid=postgres;Pwd=123456]) >> >>If lnConn < 0 >> MessageBox( "Couldn't connect to the database !" ) >>ELSE >> MessageBox( "OK !" ) >> =SQLDisconnect( lnConn ) >> >>Endif >> >>Thanks ! >> >>_________________________________________________________________ >>Express yourself instantly with MSN Messenger! Download today it's FREE! >>http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ >> >> >>---------------------------(end of broadcast)--------------------------- >>TIP 4: Have you searched our list archives? >> >> http://archives.postgresql.org >> >> > >-- >Luiz K. Matsumura >Plan IT Tecnologia Inform�tica Ltda. > > >---------------------------(end of broadcast)--------------------------- >TIP 2: Don't 'kill -9' the postmaster _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
For backup, use LPARAMETERS cFn, cserver,cuser,nport,cdatabase * Using Ed Rauh class available from Universal thread downloads LOCAL orun as api_apprun OF api_apprun.vcx EXTERNAL CLASS api_apprun.vcx LOCAL cAppl cAppl= 'pg_dump.exe' LOCAL cmdline cmdline = '"'+m.cAppl + [" -ibv -Z3 -f "]+m.cFn+ ; [" -Fc -h ]+cserver+ ; [ -U ]+user+ ; [ -p ]+TRANSFORM(nPort)+ ; ' '+ cdatabase text to lcBatText textmerge noshow @echo off @set pgpassword=<<this.cpassword>> @echo <<cmdline>> >backuplog.txt @echo <<"Creating backup "+m.cFN>> @echo <<"Wait ">> <<cmdline>> 2>>backuplog.txt echo %errorlevel% >errorlevel.txt ENDTEXT lcHere=fullpath(set("directory")) lcBat=fullpath("tmp.bat") strtofile(lcBatText, lcBat) orun=Newobject('api_apprun','api_apprun.vcx', '', lcbat, lcHere) IF !orun.launchappandwait() messagebox( m.cAppl + ' ; ' + ; "Cannot run" ) DELETE FILE (lcbat) DELETE FILE backuplog.txt DELETE FILE errorlevel.txt RETURN .f. ENDIF IF orun.CheckProcessexitcode()#0 DELETE FILE (m.cFN) messagebox( +' Backup process error ; '+ ; TRANSFORM(orun.checkprocessexitcode(),'@0' ) ) MODIFY FILE backuplog.txt DELETE FILE backuplog.txt DELETE FILE errorlevel.txt DELETE FILE (lcbat) RETURN .f. ENDIF nErrorLevel=val(filetostr("errorlevel.txt")) IF nErrorLevel#0 DELETE FILE (m.cFN) okget( " pgdup error code " + ; filetostr("errorlevel.txt"), m.cFN, .t. ) MODIFY FILE backuplog.txt DELETE FILE backuplog.txt DELETE FILE errorlevel.txt DELETE FILE (lcbat) RETURN .f. ENDIF DELETE FILE (lcbat) IF !file(m.cFN) MODIFY FILE backuplog.txt DELETE FILE backuplog.txt DELETE FILE errorlevel.txt RETURN .f. ENDIF ""ionut ichim"" <ionutichim@hotmail.com> wrote in message news:BAY106-F28EC6A8A9B6424BA2CACA5C0790@phx.gbl... > Thanks for answer. > I'm interest how can i work with pg +VFP ... connections,sored > procedures,backup ,etc > Some links for simple examples, to test. > > > > > >>From: "Alejandro D. Burne" <alejandro.dburne@gmail.com> >>To: pgsql-odbc@postgresql.org >>Subject: Re: [ODBC] examples VFP with Postgresql >>Date: Thu, 8 Mar 2007 09:26:10 -0300 >> >>2007/3/7, ionut ichim <ionutichim@hotmail.com>: >>>I'm looking for some examples VFP with Postgresql ? >>>thanks. >> >>I'm using vfp with postgresql, what kind of examples? >> >>Alejandro >> >>---------------------------(end of broadcast)--------------------------- >>TIP 1: 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 > > _________________________________________________________________ > Express yourself instantly with MSN Messenger! Download today it's FREE! > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org >
Use SQLSTRINGCONNECT([Driver=PostgreSQL Unicode;Host=127.0.0.1;Database=persoane;User=postgres;Password=123456]) ""ionut ichim"" <ionutichim@hotmail.com> wrote in message news:BAY106-F345418F785C1F0A197B558C0850@phx.gbl... >I want to try postgresql with VFP 8 sp1, but i can't connect to new created >database. > I've installed pq + odbc driver. With pgAdminIII,I can connect to my > database using password '123456' and default user 'postgres',default port > 5432 ,but with VFP i can't.Connection is a local one > This is the code I use (it always gives me 'Couldn't connect to the > database!') : > > > Local lnConn > lnConn = > SQLSTRINGCONNECT([Driver={PostgreSQL};Server=127.0.0.1;Port=5432;Database=persoane;Uid=postgres;Pwd=123456]) > If lnConn < 0 > MessageBox( "Couldn't connect to the database !" ) > ELSE > MessageBox( "OK !" ) > =SQLDisconnect( lnConn ) > > Endif > > Thanks ! > > _________________________________________________________________ > Express yourself instantly with MSN Messenger! Download today it's FREE! > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org >
With your suggestion works,thanks ! Thanks to Luiz K. Matsumura. >From: "Andrus" <kobruleht2@hot.ee> >To: pgsql-odbc@postgresql.org >Subject: Re: [ODBC] Ii can't connect to postgresql with VFP 8 >Date: Tue, 6 Mar 2007 18:04:31 +0200 > >Use > > SQLSTRINGCONNECT([Driver=PostgreSQL >Unicode;Host=127.0.0.1;Database=persoane;User=postgres;Password=123456]) > >""ionut ichim"" <ionutichim@hotmail.com> wrote in message >news:BAY106-F345418F785C1F0A197B558C0850@phx.gbl... > >I want to try postgresql with VFP 8 sp1, but i can't connect to new >created > >database. > > I've installed pq + odbc driver. With pgAdminIII,I can connect to my > > database using password '123456' and default user 'postgres',default >port > > 5432 ,but with VFP i can't.Connection is a local one > > This is the code I use (it always gives me 'Couldn't connect to the > > database!') : > > > > > > Local lnConn > > lnConn = > > >SQLSTRINGCONNECT([Driver={PostgreSQL};Server=127.0.0.1;Port=5432;Database=persoane;Uid=postgres;Pwd=123456]) > > If lnConn < 0 > > MessageBox( "Couldn't connect to the database !" ) > > ELSE > > MessageBox( "OK !" ) > > =SQLDisconnect( lnConn ) > > > > Endif > > > > Thanks ! > > > > _________________________________________________________________ > > Express yourself instantly with MSN Messenger! Download today it's FREE! > > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 4: Have you searched our list archives? > > > > http://archives.postgresql.org > > > > > >---------------------------(end of broadcast)--------------------------- >TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq _________________________________________________________________ Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/