AnsweredAssumed Answered

Using PHP and ODBC with FMSA 11 causes long fields to be truncated to 255 chars

Question asked by MattWhite on Nov 16, 2010
Latest reply on Dec 28, 2010 by TSGal


Using PHP and ODBC with FMSA 11 causes long fields to be truncated to 255 chars


FileMaker Server


fmsa 11 v.

Operating system version

Windows 2k3 server sp2 or windows 2k8 R1

Description of the issue

Using ODBC and PHP (version tested is 5.2.12) when a select is peformed against a field (text) longer than 255 chars, the result is truncated to 255 chars.

This same database, same php installation does not truncate the fields when used with FMSA v.9

Using ODBC with other tools, (Filemaker ODBC import, OPEN Office DB import via ODBC) does NOT cause truncation.

Steps to reproduce the problem

1. Can supply a test database containing only one table, two fields, or create one from scratch. Make sure it has a text field with greater then 255 chars. Add username admin, password admin with global access.
2. Open DB on FMSA 9 and also FMSA 11 servers, sharing via odbc.
3. Set up two DSN's one (DSN Name 'fm9_test' ) with the older datadirect 5.5 odbc driver to connect to the FMSA 9 server, one (DSN Name 'fm11_test')with the new FM ODBC driver to connect to FMSA 11 server.
4. Run the php supplied  It will properly pull out the non truncated field from the test database using the FMSA 9 DSN, but the FMSA 11 DSN will be truncated.
5. The php will runn both queries, outputing the length and content of the field returned from the queries.

Expected result

The entire contents of the test field should be returned by both queries.

Actual result

The query from the FSMA 11 server returned a length of 255 and only 255 chars from the field.

Exact text of any error message(s) that appear

Test PHP used.
$odbc_conn = odbc_connect('fm11_test', 'admin', 'admin');
$odbc_conn4 = odbc_connect('fm9_test', 'admin', 'admin');
function testODBC($odbc_conn)
       $sql = "SELECT test FROM test_odbc";     
       $rs = odbc_exec($odbc_conn, $sql);
       odbc_binmode ($rs, ODBC_BINMODE_PASSTHRU);
       odbc_longreadlen ($rs, 0);
          if ($error = odbc_errormsg($odbc_conn)) {
               echo "Error = $error";
          } else {
               while (odbc_fetch_row($rs))
                                   $test = odbc_result($rs,'test');
           $length = strlen($test);
           echo "
Length = $length


Configuration information

1. Changing PHP odbc_longreadlen (to 0 or some large # like 100000000) makes no difference.
2. Changing PHP odbc_binmode makes no difference.
3. Changing the cursor type in the odbc_conn (to 0, 1, 2) makes not difference.
4. Other ODBC data sources do not display this trunctation (i.e. mysql)
5. Testing on both 32bit win2k3 server and 64 bit win2k8 server R1. Same issue on both.
6. Again the same query, same php install will work properly against the same DB if hosted by FMSA 9


None Found.