ODBC & Rev on a Mac

Tariel Gogoberidze PMDA at earthlink.net
Thu Mar 7 13:18:01 EST 2002


> From: OkayActivist Kemetian <okpkemetian at yahoo.com>
> Subject: ODBC & Rev on a Mac

> I am trying to use the database manager to connect to
> a Filemaker Pro 5.5. database on Mac OS 9.2.  With it
> comes the ODBC control panel 3.51.  when i try to make
> the connection in Rev's DB Manager i get the following
> error:
> 
>..........
> 
> i simply want to be able to add data to fields and
> retrieve the data from the Filemaker Pro db using Rev.
> i've looked at the help in the database manager to no
> avail and the vb/rev comparison eg app is developed on
> windows.
>



You may also use FMP web companion  to add/retrieve  data  from  FMP.
BTW, this works much  faster then ODBC.
Generally,  all you have  to do is  to type


post  "-db=employees.fp5&-lay=layoutName&-format=formats.htm&first
name=Doe&last name=Jons&-find" to url "192.129.74.247"

put urldecode  (it) into  field 1

where

"192.129.74.247" = your IP address  (assuming you are online,  if you 
are not,  there  is another  way to communicate  with  FMP locally)
employees.fp5 =  the  name of your  FMP database
layoutName = the name of layout you  are referring  to
formats.htm = response  file  that should be  located in your  "web" 
folder inside the  FMP application  folder and  which  contains names of
the  fields  you want to retrieve after search,  for example

[Found_Count]
[FMP-Field: grade]
[FMP-Field: address]

note: folder named  web  is  a  folder  inside your FMP  application 
folder  where FMP  looks  by default for  format  (response)  files

However, it  was (or still is?)  a  bug  in LibURL that  was preventing
post  command to work  with FMP.  If  this bug is still  a case  you 
can  use your own  costume socket  function to send/retrieve  data, for example:


#########
on mouseUp
  put  "-db=employees.fp5&-lay=layoutName&-format=formats.htm&first
name=Doe&last name=Jons&-find" into TheCall
  
  put number of chars of TheCall into Nchars
  
  put "160.129.74.247" into TheURL
  
  put "POST /employee_database/FMPro? HTTP/1.0" & CRLF into tString
## employee_database is a folder inside  your  web  folder
  put "host: " &TheURL& CRLF after tString
  put "Content-Type: application/x-www-form-urlencoded" & CRLF  after tString
  put "Content-Length: " & Nchars&  CRLF & CRLF &TheCall after tString
  
  
  open socket  to TheURL
  write tString to socket TheURL -- send your data to socket
  read from socket TheURL until CRLF
 ## confirmation from the server = "HTTP/1.0 200 OK"
  read from socket TheURL until  CRLF &  CRLF
 ## Returned header from.Server:
 ## FileMakerPro/5.0
 ## MIME-Version: 1.0
 ## Content-type: text/html
  
  read from socket  TheURL for 100000
 ## here I don't  know for how many chars  I should read, 
 ## because "content-length" is not  returned in the header (also the
reason why LibUrl fails)
 ## so  I picked some random number
  CLOSE SOCKET TheURL
  put urlDecode(it) into  last fld
  
end mouseUp
###############


Of course  this function is simplified, no error checking 
etc, but it should  work  with FMP

Best  regards
Tariel Gogoberidze



More information about the use-livecode mailing list