connecting to quickbooks database via odbc with php?

m42 picture m42 · Mar 3, 2009 · Viewed 20.9k times · Source

[edit]
We're collecting credit application data from users on a web form.

I have not tied my web form directly into QB.

I have no idea what the QB table structure is for this collection of data - nor of how it displays it to the user because I've never actually worked directly with QB. Others in my office do however.


I would still appreciate any information about open source / free options.


I'll simplify the problem by removing the first desired option.

Let's just talk about importing a flat file into quickbooks.

I don't have a copy of quickbooks that I can play with, so I have no idea what options exist that are native to quickbooks but I see some chatter on the web about QB expecting an .ini file for imports. (don't know the format that it expects yet, but I'll get that worked out later)

Please share your story if you have managed to import a flat file from mySQL into quickbooks or know of links that offer insight (I'm not finding much right now).
[end edit]

I realize that this scenario is probably uncommon, but I need to connect to an existing quickbooks database in one of two ways.

1) either directly from a php script running on our web site -- insert user supplied data directly from web to quickbooks.

or

2) put user's data directly into mySQL database and later export data from mySQL to quickbooks.

If the first option is viable, I would appreciate your thoughts on establishing an odbc connection to the quickbooks database.

can I go about it with something like:

try {
  $conn = @odbc_connect("DSNName", "", "", "SQL_CUR_USE_ODBC");
  // un and pw parameters are passed as empty strings since the DSN 
  // has knowledge of the password already.
  // 4th parameter is optional

  $exec = @odbc_exec($conn, $insert) or die ("exec error");
  echo "success!";
}
catch (Exception $e) {
  echo $e->getMessage();
} // end try catch

Answer

Jas Panesar picture Jas Panesar · Mar 7, 2009

The third option might work for you.

Option 1 - QODBC: If you're looking for simplicity, Qodbc as mentioned above is the main product that does it, and it does cost money.

Option 2 - Quickbooks SDK: If you're okay working through the SDK and using their XML structures, you can find some great resources on the developer network. Accounts are free for the SDK and you can work your way through it fairly easily.

This boils down to one thing, if you want it free, you might not be able to get it your way.. QODBC is reasonably priced the last time I checked.

The one thing that is important to be aware of with either approach -- ensure the tables you wish to write data into in Quickbooks are available by the SDK and QODBC.

As Quickbooks has gotten older, access to some tables have disappeared. For example, it's not possible to write directly to the payroll deductions table directly as it competes with Intuit's Payroll Service.

Option 3 - Direct SQL manipulation: Intuit encrypts their data in their SQL data making it unavailable for direct access.

Edit: Option 4 - Quickbooks Web Connector SOAP wrapper that sits on the computer with Quickbooks and interacts with it for you. Also free.

Good luck!