We have reset all users FileMaker related profile fields. Please take the opportunity to update your information,  this will provide background to members whom read your posts. Click here.

Jump to content
Sign in to follow this  
James Gill

Using FMSA as an ODBC Data Source with the PHP PDO class

Recommended Posts

James Gill    8

I am attempting to use Filemaker as an ODBC datasource in place of MySQL. I am currently running PHP 5.5.3 and am attempting to create a PDO that will utilize the Filemaker ODBC connection. However, I am unable to successfully connect to the database as I am getting an error that says "Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /Applications/MAMP/htdocs/OMIS/core/init.php:6 Stack trace: #0 /Applications/MAMP/htdocs/OMIS/core/init.php(6): PDO->__construct('odbcbiggrin.pngriver={Fi...', 'odbc', 'odbc') #1 {main} thrown in/Applications/MAMP/htdocs/OMIS/core/init.php on line 6"

I know that the both the Filemaker ODBC Driver and the DSN for the database exist but I'm still getting the error. The code I'm using to temporarily test the connection is:
 

PHP Code:
$dsn 'odbc:Driver={FileMaker ODBC};Server=localhost;Database=cwp_data;';
$pdo = new PDO($dsn"odbc""odbc");  

I do have some questions. First, does the 'Server' param need to be where the DSN is configured (localhost in this case) or where the database is hosted (external server). Second, is the PDO being handled correctly here? I am unable to find any resources on using a Filemaker database with the PDO class, so I'm sort of winging it here.  I'm still researching the topic so it's entirely possible that I've missed something.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Similar Content

    • By jamescv7
      XML error: No memory at line 1
      Greetings, this error occurred when the Filemaker API cannot generate a bunch of records. (1000+ records and above)
      I've adjusted the time out settings for PHP even the memory limits.
      Is there any possible solution for this?
       
      According to some information, the error turns out that the 10 MB XML scripts is unchangeable.
      thanks.
    • By Ken d'Oronzio
      FREE fmREST.php – Simplifies & manages PHP connections to FileMaker 16’s REST-based Data API.
      The newly released FileMaker Server 16 now offers REST access to your FileMaker databases. There’s more about that how this impacts PHP developers here.
      The bottom line is that to use REST as part of your PHP solution, you would usually need to write a series of cURL functions and you would have to manually manage connecting & disconnecting from your server, and saving your tokens.
      This is a pain!
      We know it’s a pain, because we have spent the last several weeks rolling REST functionality into soSIMPLE Calendar.
      We created this class file to make it easier to manage dynamic REST sessions for soSIMPLE and our custom development. The goal of the class file was to help PHP developers start using the new REST engine as quickly and easily as possible.
      We’ll also be updating it with new features. If you’d like to add something to it, please let us know.
      What fmREST.php does:
      Makes every REST call available as a PHP function. Automatically login into FileMaker Server whenever you call any REST functions Saves your token for 15 minutes to reuse Checks for a broken or disconnected token and automatically reconnects and runs your function again Where do I get it?
      You can download the fmREST class file here.
    • By GisMo
      I have a php script that takes two PDF files and merges them into one file. I am using this in conjunction with the insert from URL script step. 
      The way the script works is it takes two PDFs in container fields and base64encode each files. Then, those two base 64 strings are POSTed via insert from URL.
      I've tested the script forwards and backwards and it does combine the PDF files reliably. The issue is when posting from FileMaker. What typically happens is the first page is combined twice and that's my resultant PDF. 
      My php script checks that both inputs are different and throws an error is they are identical. I don't get any errors there.
      Is there a way to POST a file from insert from URL?
    • By Jason Mundok
      I have a website that is displaying FileMaker data using the PHP API. Is there a way for the web site to display the basic text formatting from a FileMaker field? For example, a few words in the comments field are bold in FileMaker and I would like them to also be bold on the website. Thanks for any ideas.
    • By randyinla
      Hi, I have a field called 'mytournament1'.  I also have a field called 'mytournament1played'.  With a form, I create the variable $tournament to bring 'mytournament1' to my results page.
      $tournament = $_GET['tournament'];
      I'd like to force the results page to search for the field 'mytournament1played' for each record by using the variable $tournament and combining the word 'played' or the variable $played.  
      $played = 'played';
      $tournamentplayed = $tournament . $played;
      $tournamentplayed2 = $record->getField('$tournamentplayed');
      (I want it to deliver)      $record->getField('mytournament1played');

      I know the 1st '$record->getField' line is wrong.  Can I combine 2 variables that spell out a database field name (mytournament1played) that can be used to call up a field in a search?  i.e.
      if ($tournamentplayed2!='1') {

      thanks in advance for your help!
       
×