-
VFP ODBC primer
Hi guys
Looking to use VFP ODBC driver to connect Lianja app to be able to add data to existing VFP table. Lots of you must have done something similar.
Never used ODBC before and read quite a lot but the 1st steps to getting it up and running seem illusive and are never mentioned.
1. Where can we download the VFP ODBC driver(s) from? We've downloaded and installed just about everything that says it is a VFP ODBC driver but none appear in the ODBC Data Sources in windows (32 or 64 bit even after reboot) even though there are drivers for loads of other formats, including Lianja.
2. Once that is achieved, presumably the username and password are just left blank as "unauthenticated access" has no meaning in VFP?
3. If the server is on the same network, how do we set up the path to the file?
Once that is set up, using virtual tables inside Lianja is documented fairly well.
Virtual tables look like a great idea and flexible too but is ODBC going to be more reliable than using a web service to just send the data to?
Thanks in advance
Simon
-
Hi Simon,
That newest VFP ODBC Driver produced by Microsoft is for VFP6. DevArt has a driver that works for VFP9 data types, as Barry has mentioned.
VFP ODBC drivers works just as any ODBC driver works. You just have to know the connection string properties. DevArt will supply that information. In general, www.connectionstring.com has specs for all the common drivers.
Code:
lcConnStr = "your connstring goes here"
lnHandle = sqlstringconnect(lcConnStr)
ln = sqlexec(lnHandle,"select fielda, fieldb from tablea","mycursor")
The connstring info and the sqlexec select string can be used in a Virtual Table.
hth,
Hank
PS: unless you have to keep the old code running, the better choice is to move everything over to Lianja.
PPS: to find the VFP6 ODBC Driver, google (without the quotes) "vfp odbc driver download" I would strongly suggest getting the DevArt ODBC driver to avoid gotchas. I don't have a comprehensive list, but you can find references on the web with a little searching.
-
Thanks Hank
That's a big help
Simon
-
You should be aware though, that all those ODBC drivers are not able to run any trigger code, since they're lacking the VFP runtime to interpret that code. Therefore,if an installation relies on Triggers, don't do any Updates, Deletes or Inserts via ODBC.
BTW: It's a similar problem with Servoy and their Java-based VFP-driver.
-
Good info. Also worth pointing out is that Lianja ODBC driver is a proper client server driver using TCPIP network protocol. The server has the full Lianja engine embedded within it so stored procedures and triggers work as expected.