Hi John,
I'm really disappointed that nobody seem to be able to connect. You might check the program and make sure that everywhere a connection is being made that the connection string is calling the proper ODBC Data Source in the control panel. The first version of the client I posted used PostgreSQL11 to call the ODBC connection in the control panel. I changed this as follows:
oConnection=SQLConnect("PostgreSQL","VfP2Pg","HelloWorld")
This line should appear three times in the testorders form and one time in the sql_select.prg. Of course your ODBC Data Source connection should be named PostgreSQL.
I have turn the firewall off of my linux box to eliminate it as a possible problem. Also, I checked my Linksys router and it has the following:
port range Protocals Open Forward to
----------------- -------------- ----------------
5432 to 5432 TCP and UDP 192.168.1.78
I think postgres only need this one port, but I'll check to see if a range of large range of ports is needed.
The router's wan address or static IP address is 68.15.242.103. This is the only address that should be seen outside the local network. Everything coming into this address is forwarded to IP 192.168.1.78 which is my linux web server, mail server and postgres server.
www.smvfp.com should resolve to this address. However, since everything is working with my local network, I wonder if using
www.smvfp.com could be the problem. You might try the following as the Server in you ODBC data source found in the control panel
Server: 68.15.242.103
oConnection=SQLConnect("PostgreSQL","VfP2Pg","HelloWorld")
If I can get this working I'm thinking about submitting it for possible inclusion in the next vfug newletter. Any help is much appreciated.
If you can't make a connection to my Linux box, you could set up your own postgres database named vfp2pg
then create a table named testorders
give testorders the following structure:
field TYPE Length Not Null
----- ---- ------ --------
cno Serial Yes &&make this index primary unique
first varchar 35 No
last varchar 21 No
date_it timestamp 8 No
company varchar 40 No
address varchar 40 No
city varchar 20 No
state varchar 2 No
postal varchar 12 No
phone varchar 12 no
email varchar 35 No
pass_key varchar 11 No
payby varchar 3 No
cartype varchar 15 No
carholder varchar 25 No
carnumber varchar 16 No
cardmonth varchar 2 No
cardyear varchar 4 No
amount float8 8 No
processed varchar 3 No
Once this is done make sure you have a sequence that automatically create a unique number to go into the cno field. It should be named testorders_cno_seq. Once this is done you could then connect to your own vfp2pg database and use the rich function of a VFP 7 Front End.
By the way, exactly what is the error message are you getring when trying to make the connection?
I have used the perl DBI to connect to a postgres database in a web server setting and vfp 7 works about the same way, excecpt VFP 7 is a lot faster on the client side and provides a lot more functionality (e.g. HTML form compared to VFP 7 form. I havn't done this yet but you should be able to easily create a database and tables with a VFP client by using SQLEXEC(). Just study the syntax needed by postgreSQL and have the VFP cleint pharse a statement and send it to postgreSQL Back End. It should be just like your typing at a command window.