Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

Buy Support
Incidents

If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:

Click Here
If you can't login and post questions or you are having trouble viewing forum posts:
Click Here
Callback
Support

If you live in USA, UK, Canada, Australia or New Zealand, you can leave us details on your question and request us to call you back and discuss them with you personally  (charges apply).

Click Here
 
Buy Support
Incidents
If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:
Click Here

Forum : Performance Issues of QODBC Read Write in QB 05Search Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC Frequently Asked Questions

 New Topic 
 
 Post Reply 
[1]  
 Performance Issues of QODBC Read Write in QB 05 
 Author   Message 
  ione 
  
 Group: Members 
 Posts: 4 
 Joined: 2006-08-03 
 Profile
 Posted : 2006-10-11 01:57:20

Hi

 

We have recently purchased QODBC, for a single user.  But to excute the Query it is taking too many hours. If we have to insert about 10 records into my Quickbook 2005 file it is taking about 20 min.  and if we are executing a query for a 90 records after a long time, it times out with a message "Execution Timed out". As an end user we do not feel that this is not normal and not workable response time for this query.  We feel it may be problem in my code(Listed Below) or configurations of the qodbc or there may be some patches that we have not installed to over come the performance issues.  We need your help…… I am providing a summary below.

 

Task 1.

We have financial in an Excel Spreadsheet.  We are running a PHP Script and connect to Quick books 2005 using the qodbc as the connector / bridge and updating/inserting  records in Quick Books 2005.

 

Task 2.

We are trying to insert 10 records into QB Customer  table.  The total No# of Records in Customer table in my QB file is only 500 records, and the size of the QB file is 20 MB. This is not to huge data for QODBC to take over 20 mins!!!. We need to insert/update daily 100 customer records and I can’t get even to run because it times out….

 

Details:

   1. In QB, We have to insert/update Customer data base on the Account NO., i.e a field in Payment section of Customer Details. That Account no. is actually a Customer Id for us, since only the Account No. Field is searchable in QB, we have used that Account No field to store customer Id.

   2. Example of Customer Data

 

  • CUST[tab] Prof L Solutions (Brian John)[tab] 2 Summit Park Drive[tab] [tab] Independence[tab] OH[tab] 44131[tab] 2 Summit Park Drive[tab] [tab] Independence[tab] OH[tab] 44131[tab] 216-444-4444[tab] 440-888-8888[tab] 216-333-3333[tab] abc@yahoo.com[tab] 4973[tab] Brian John[tab] [tab] Web[tab] Due on receipt[tab] Y[tab] None[tab] [tab] [tab] [tab] [tab] Prof L Solutions [tab] Brian[tab] [tab] John[tab] 440-222-2222[tab] Johnbk[tab] 01/08/2006[tab] [tab] [tab] [tab] [tab] [tab] [tab] [tab] [tab] [tab] [tab] [tab] [tab] Base sales price
  • My code (details for qodbc is below)

 

I need help.  I have been trying and I am stuck for quite a few days.  I would appreciate any help you can give me on this.  Thank you….

 

My Code for QODBC:

 

<?             

      set_time_limit(12000);

      /* ----------------------- NETSUITE Data Fetch -----------------*/

      function csv_explode($str, $delim = ',', $qual = "\"")

    {

       $skipchars = array( $qual, "\\" );

       $len = strlen($str);

       $inside = false;

       $word = '';

       for ($i = 0; $i < $len; ++$i) {

           if ($str[$i]==$delim && !$inside) {

               $out[] = $word;

               $word = '';

           } else if ($inside && in_array($str[$i], $skipchars) && ($i<$len && $str[$i+1]==$qual)) {

               $word .= $qual;

               ++$i;

           } else if ($str[$i] == $qual) {

               $inside = !$inside;

           } else {

               $word .= $str[$i];

           }

       }

       $out[] = $word;

       return $out;

    }

 

      $fcontents1 = file ("C:\\D_MOD.csv");

      $oConnect = odbc_connect("QuickBooks Data", "", "");

      //$oConnect = 1;

      if($oConnect)

      {

                  //echo "<br>Connection done<br>";

                  for($i=1; $i<15; $i++)

                  {

                              $line = trim($fcontents1[$i]);

                              $csv_str = ereg_replace('"',"\"",$line);

                              $arv = csv_explode($csv_str);

                              $q = 0;

                              $aclen = strlen($arv[1]);

                              // ZERO setting start

                                          $accountno = $arv[16];

                                          $len = strlen($accountno);

                                          $maxlen = 6 - $len;

                                          $faccountno = $accountno;

                                          //echo "<br>Account : ".$faccountno;

                                          for($loop=0;$loop<$maxlen;$loop++)

                                          {

                                                      $faccountno = "0".$faccountno;

                                          }

                                          //echo "<br>Account no in Query : ".$faccountno;

                             

                              if($arv[1] != "")

                              {

                                          //  Check User Exists or Not STARTS --------------------------

                                                      $sSQL_usrcheck= "SELECT * FROM Customer WHERE AccountNumber = '$faccountno'";

                                                      print "<br><br><br>I : ".$i." - ".$sSQL_usrcheck;

                                                      $oResult_usrcheck = odbc_exec($oConnect,$sSQL_usrcheck);

                                                      $RowCnt = 0;

                                                      $RowCnt = odbc_num_rows($oResult_usrcheck);

                                                      echo "<br>Record With that Account Number : ".$RowCnt;

                                                      if($RowCnt)

                                                      {

                                                                  //----------------------- Quickbook Updation Starts here --------------------

                                                                              $sSQL = "UPDATE Customer

                                                                                                   SET 

                                                                                          BillAddressAddr1 = '$arv[2]', BillAddressAddr2 = '$arv[3]',

                                                                                          BillAddressAddr3 = '$arv[4]', BillAddressState = '$arv[5]',

                                                                                          BillAddressPostalCode = '$arv[6]', ShipAddressAddr1 = '$arv[7]',

                                                                                          ShipAddressAddr2 = '$arv[8]', ShipAddressAddr3 = '$arv[9]', 

                                                                                          ShipAddressState = '$arv[10]',ShipAddressPostalCode = '$arv[11]',

                                                                                          Phone = '$arv[12]', AltPhone = '$arv[13]',

                                                                                          Fax = '$arv[14]', Email = '$arv[15]',

                                                                                          Contact = '$arv[17]', AltContact = '$arv[18]',

                                                                                          TermsRefFullName = '$arv[20]', ResaleNumber = '$arv[24]',

                                                                                          Notes = '$arv[25]', Salutation = '$arv[26]',

                                                                                          CompanyName = '$arv[27]', FirstName = '$arv[28]',

                                                                                          LastName = '$arv[29]',

                                                                                              CustomFieldCUST1 =  '$arv[31]', CustomFieldCUST2 =  '$arv[32]',

                                                                                              CustomFieldCUST3 =  '$arv[33]', CustomFieldCUST4 =  '$arv[34]',

                                                                                              CustomFieldCUST5 =  '$arv[35]', CustomFieldCUST6 =  '$arv[36]',

                                                                                                 CustomFieldCUST7 =  '$arv[37]'

                                                                                                 where AccountNumber = '".$faccountno."'";

                                                                              print "<br>Update : ".$i." - ".$sSQL;

                                                                              $oResult = odbc_exec($oConnect, $sSQL);

                                                                  //----------------------- Quickbook Updation Ends here --------------------

                                                      }         

                                                      else

                                                      {

                                                                  //----------------------- Quickbook Insertion Starts here --------------------

                                                                             

                                                                              $sSQL = "INSERT INTO Customer

                                                                                                                              (

                                                                                                                                 Name, AccountNumber,

                                                                                                                                 BillAddressAddr1, BillAddressAddr2,

                                                                                                                                 BillAddressAddr3, BillAddressState,

                                                                                                                                 BillAddressPostalCode, ShipAddressAddr1,

                                                                                                                                 ShipAddressAddr2, ShipAddressAddr3,

                                                                                                                                 ShipAddressState,ShipAddressPostalCode,

                                                                                                                                 Phone, AltPhone,

                                                                                                                                 Fax, Email,

                                                                                                                                 Contact, AltContact,

                                                                                                                                 TermsRefFullName, ResaleNumber,

                                                                                                                                 Notes, Salutation,

                                                                                                                                 CompanyName, FirstName,

                                                                                                                                 LastName

                                                                                                                               )

                                                                                                        values (

                                                                                                                                 '$arv[1]','$faccountno',

                                                                                                                                 '$arv[2]','$arv[3]',

                                                                                                                                 '$arv[4]','$arv[5]',

                                                                                                                                 '$arv[6]','$arv[7]',

                                                                                                                                 '$arv[8]', '$arv[9]',

                                                                                                                                 '$arv[10]','$arv[11]',

                                                                                                                                 '$arv[12]','$arv[13]',

                                                                                                                                 '$arv[14]','$arv[15]',

                                                                                                                                 '$arv[17]', '$arv[18]',

                                               '$arv[20]', '$arv[24]',

                                                                                                                                 '$arv[25]','$arv[26]',

                                                                                                                                 '$arv[27]','$arv[28]',

                                                                                                                                 '$arv[29]'

                                                                                                                                )";

                                                                              print "<br>Insert : ".$i." - ".$sSQL;

                                                                              $oResult = odbc_exec($oConnect, $sSQL);

        &nbs 


  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-10-11 13:48:34

Your performance issues are due to your use of AccountNumber in your script. In order to locate a AccountNumber, QODBC has to do a full table scan of the Customer table in your check:

$sSQL_usrcheck= "SELECT * FROM Customer WHERE AccountNumber = '$faccountno'"

this should be:

$sSQL_usrcheck= "SELECT FULLNAME FROM CUSTOMER WHERE FULLNAME =  '$arv[1]'"

FullName is a QODBC jump-in. Jump-ins act like indexes. Likewise your UPDATE needs to use FULLNAME instead of AccountNumber. You can examine the jump-ins of any QODBC tables by doing:

sp_columns Tablename

 

 

 

  Top 
  ione 
  
 Group: Members 
 Posts: 4 
 Joined: 2006-08-03 
 Profile
 Posted : 2006-10-11 20:10:42
My problem is that customers change names very often and the only constant is the AccountNumber value. I need to update and add new customers and transaction on an ongoing basis.

Can i modify or create JUMPIN value. I want to create JUMIN for AccountNumber.

Or do you have any other suggestions besides searching by FullName, please let me know.

Thank you... 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-10-12 09:35:47
Sorry, you can't change jump-ins. The only other option is to use ListID and for you to store the ListID at your end. The ListID is actually the QuickBooks Account Number that never changes. 

  Top 
  ione 
  
 Group: Members 
 Posts: 4 
 Joined: 2006-08-03 
 Profile
 Posted : 2006-10-12 16:42:49
I tried running my PHP script on my local machine (Intel pentium-4, 1.6 ghz, 1 GB RAM) using ListId rather than AccountNumber, still it gave me error of "CGI Timeout".

Is my script i shaving some problem or connection that i created thru configuration panel of QODBC is incorrect?
I am not any solution. and i guess that on my local machine with those configuration, it should not take that much time..
Am i correct? 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-10-13 08:18:36

What search script statement are you now using?:

$sSQL_usrcheck= "SELECT FULLNAME FROM CUSTOMER WHERE FULLNAME =  '$arv[1]'"

I would test the SELECT statement part using VB Demo first to optimize the response first!

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to