1 2 Previous Next 26 Replies Latest reply on May 12, 2015 8:24 AM by TSGal

    FileMaker Server

    NickNick

      Product

      FileMaker Server

      Version

      12v3

      Operating system version

      Windows 7 32 bit

      Description of the issue

      I've tried to use php odbc to connect to filemaker database
      with the following piece of code:

      $server = ;
      $database = " $user = "";
      $password = "";

      $connection = odbc_connect("Driver=FileMaker ODBC;Server=$server;Database=$database;", $user, $password);
      $sql = "SELECT FROM

      WHERE = ?";

      $cond = ;

      $statement = odbc_prepare($connection, $sql);

      if(!$statement) {
        die("could not prepare statement ".$statement);
      }
      $resultSet = odbc_execute($statement, array($cond));

      odbc_close($connection);

      but this row:
      $resultSet = odbc_execute($statement, array($cond));

      give the following error:

      Warning: odbc_execute() [function.odbc-execute]: SQL error: [FileMaker][FileMaker] No cursor open for statement, SQL state HY000 in SQLFreeStmt in test.php

      obviously this problem is the same if avoid the paramaters, but not the odbc_prepare because is necessary

      i saw the source of odbc_execute() from here:
      http://pr-web-01.qatar.cmu.edu/src/php-5.2.6/ext/odbc/php_odbc.c

      and saw that the problem was connected with this instruction:
           /* Close cursor, needed for doing multiple selects */
           rc = SQLFreeStmt(result->stmt, SQL_CLOSE);

      Could you help me to solve?

        • 1. Re: FileMaker Server
          philmodjunk

               Is this for FileMaker Server 12 or FileMaker Server Advanced 12? It is my understanding that FileMaker Server does not support ODBC.

          • 2. Re: FileMaker Server
            NickNick

                 Yes, is filemaker server advandced 12

            • 3. Re: FileMaker Server
              NickNick

                   Could you give me some feedback?

                    

                   Please!!!!

              • 4. Re: FileMaker Server
                NickNick

                     Could you give me some help, please?

                • 5. Re: FileMaker Server
                  NickNick

                       Could you give me some feedback?????????????????????????????????????????????????????????????.

                       I have a filemaker server 12v3 advanced and i have tried to access to filemaker file by odbc and php with statement clause like:

                       SELECT * FROM TABLE_NAME WHERE FIELD = ?

                       and i had the problem above....

                        

                       My question is:

                       is possible to use odbc with php in filemaker?

                       For me is impossible to use the Filemaker.php library to change format and launch script because the use of SQL is a MUST, and then, why you filemaker developer programmer had made odbc and jdbc for .Net and Java and avoid php, perl python and other language, IS CRAZY, ISN'T IT?

                        

                       And for another time, WHY YOU DON'T WANT TO HELP ME AND GIVE SOME FEEBACK of this problem and eventually some solution?

                  • 6. Re: FileMaker Server
                    TSGal

                         Nick Nick:

                         Thank you for your post.

                         Assuming the database file has ODBC Sharing turned on along with everything else set up properly, try sending a simple SQL command like:

                         SELECT <fieldname> FROM <tablename>

                         Do you get an error?  If so, what is the error?  If this works, then specify a constant in the WHERE clause.

                         If your PHP code is able to access the ODBC driver, then you should be able to send the supported SQL commands.  For a SQL reference supported by FileMaker Server 13 (we don't have a document for Server 12), see:

                    https://fmhelp.filemaker.com/docs/13/en/fm13_sql_reference.pdf

                         I recommend entering the suggestions for other language drivers (Perl, Python, etc.) into our Feature Requests web form at:

                    http://www.filemaker.com/company/contact/feature_request.html

                         The entries into this web form populate a database that is hosted and monitored by Product Management and Development.  Each suggestion is discussed and considered for possible implementation in a future release.  Although I can copy your request and paste it into the web form, there are a couple of questions asked on the form that only you can answer.

                         TSGal
                         FileMaker, Inc.

                    • 7. Re: FileMaker Server
                      NickNick

                           for the filemaker 13 is the same problem infact is a problem of odbc driver.

                           if i use the SQL string without question marks (?) or, in other words, without parameters, everyting go correctly.

                           On the other and if i use the parameter (?) the program give the following error:

                           Warning: odbc_execute() [function.odbc-execute]: SQL error: [FileMaker][FileMaker] No cursor open for statement, SQL state HY000 in SQLFreeStmt in test.php

                           obviously the problem is linked with the combination of sql with the parameters in php with yours odbc driver wrote in c/c++ (i suppose) and, because i think the same yours odbc driver wrote in c/c++ is used by the perl and python too, i suppose that language will give the same problem... but it doesn't mattern now because i interested aboud the php sql statement and odbc combination.

                           i summarize:

                           without statement everything is ok, this instruction is ok:

                           $resultSet = odbc_exec($connection, $sql); sql can have where, and, or, everithing

                           but when i use the statement:

                           $statement = odbc_prepare($connection, $sql);
                           $resultSet = odbc_execute($statement, array($a, $b, $c));
                            

                           the system give the error in the top of this forum:

                           Warning: odbc_execute() [function.odbc-execute]: SQL error: [FileMaker][FileMaker] No cursor open for statement, SQL state HY000 in SQLFreeStmt in test.php

                           Because i suppose you and your collegues are programmer like me, and i suppose you know not only the rdbms filemaker but other sql rdbms (like mysql, oracle, sql server, postgres, access and other), obviosly the possibility to use of sql paramatrized is a must, not only for the sql injection (for instance), but for flexybilty, portability, and things.

                           For another time,

                           can you help me about this?

                           Can you solve this problem?

                           Thanks.

                      • 8. Re: FileMaker Server
                        TSGal

                             Nick Nick:

                             I have sent along your entire post to our Development and Testing teams for review.  When I receive any feedback, I will let you know.

                             TSGal
                             FileMaker, Inc.

                        • 9. Re: FileMaker Server
                          TSGal

                               Nick Nick:

                               Here are notes from the Tester:

                               -----

                               The customer mistook the usage of "odic_execute()" in PHP, which is meant to return a boolean value; not a result set.

                               The correct usage would be:

                               <?php
                               $resultSet = odbc_prepare($connection, $sql);
                               $ret = odbc_execute($resultSet, arry($cond)) ; #ref is boolean
                               echo odbc_result_all ( $resultSet )(
                               $resultSet )
                               ?>

                               -----

                               The Tester also mentioned there is an issue with odic_execute() where it would return an error "No cursor open for statement..." when it's executing a query rather than data modification statement (insert/update/etc.); although the query can be correctly executed.

                               TSGal
                               FileMaker, Inc.

                          • 10. Re: FileMaker Server
                            NickNick

                                 The customer mistook the usage of "odic_execute()" in PHP, which is meant to return a boolean value; not a result set.

                                 The correct usage would be:

                                 <?php
                                 $resultSet = odbc_prepare($connection, $sql);
                                 $ret = odbc_execute($resultSet, arry($cond)) ; #ref is boolean
                                 echo odbc_result_all ( $resultSet )(
                                 $resultSet )
                                 ?>

                                 I don't think so, because the $resultSet and the $ret are the simple name of variable, is possible to write this to:

                                 The customer mistook the usage of "odic_execute()" in PHP, which is meant to return a boolean value; not a result set.

                                 The correct usage would be:

                                 <?php
                                 $var1 = odbc_prepare($connection, $sql);
                                 $var2 = odbc_execute($var1, arry($cond)) ; #ref is boolean
                                 echo odbc_result_all ( $var2 )(
                                 $var2 )
                                 ?>

                                 for the last time, infact the problem is in this instruction:

                                 odbc_execute($anyNameOfVariablesPrepare, array($anyNameOfVariableConditions)

                                 and then:

                                 The Tester also mentioned there is an issue with odic_execute() where it would return an error "No cursor open for statement..." when it's executing a query rather than data modification statement (insert/update/etc.); although the query can be correctly executed.

                                 Ok, but now; you and your colleagues have a solution or not, you'll try to correct this bug or not?

                                 on the other hand, you don't discover nothing different from the the topi of this post, but only confirmed my request:

                                 /*******************************************/

                                 this row:
                                 $resultSet = odbc_execute($statement, array($cond));

                                 give the following error:

                                 Warning: odbc_execute() [function.odbc-execute]: SQL error: [FileMaker][FileMaker] No cursor open for statement, SQL state HY000 in SQLFreeStmt in test.php

                                 /********************************************/

                                 but in this case, have you or your colleagues seriously intention to solve this bug, or continue to answer with some complains with the name of some php variables??

                                 in other works, what is the solution?

                                 thanks and hope of yours help

                                 Bye.

                            • 11. Re: FileMaker Server
                              TSGal

                                   Nick Nick:

                                   Yes, there is an unexpected error returned when odic_execute executes a prepared query.  According to the tester, the query executes successfully even though the error is generated.  For example,

                              $connection = odbc_connect("Driver=FileMaker ODBC;Server=$server;Database=$database;", $user, $password);
                                   $sql = "SELECT <FIELDS> FROM <TABLE> WHERE <FIELD> = ?";
                                   $cond = <conditionValue>;</p">

                                   $r = odbc_prepare($connection, $sql);
                                   $ret = odbc_execute($r, array($cond));

                                   -----

                                   The query executes successfully.  However, error "[FileMaker] No cursor open for statement, SQLstate HY000 in SQLFreeStmt in test.php’ would be returned for odbc_execute().

                                   This error does not occur with data modification statements (e.g. preparing an insert or update).

                                   This information has been sent to Development for review.

                                   TSGal
                                   FileMaker, Inc.

                              • 12. Re: FileMaker Server
                                NickNick

                                     Excuse me but there are others problem!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                                     where i use the php sql query like :

                                     SELECT * FROM TABLE_SOME WHERE FILED1 = ? AND FIELD2 = ?

                                     THE FILEMAKER GIVE THIS RESPONSE:

                                     odbc_execute(): SQL error: [FileMaker][FileMaker] Invalid descriptor index, SQL state 07009 in SQLDescribeParameter

                                     DUE OBVIOUSLY BY THE MULTI PARAMETERS ORT ON THE OTHER HANDS YOURS ODBC DRIVERS DOESN'T SUPPORT MORE THAN ONE PARAMETER.......................

                                      

                                     IS ABSURD....

                                      

                                     ONCE AND FOR ALL, DO YOU WANT SOLVE EVERY OF THIS BUGS?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

                                      

                                     THANKS, BYE.

                                • 13. Re: FileMaker Server
                                  TSGal

                                       Nick Nick:

                                       Thank you for the additional information.

                                       I have sent the information to Development and Testing for review.  When any information becomes available, I will let you know.

                                       TSGal
                                       FileMaker, Inc.

                                  • 14. Re: FileMaker Server
                                    TSGal

                                         Nick Nick:

                                         Our Testers would like your database file and complete code that fails so they can investigate further  Check your Inbox at the top of this page for instructions where to send these files.

                                         TSGal
                                         FileMaker, Inc.

                                    1 2 Previous Next