Knowledgebase: Setup
[QODBC-Desktop] QB Begin Session Failed. Error = 8004041c
Posted by brad waddell on 12 March 2009 05:21 PM

Troubleshooting: QB Begin Session Failed. Error = 8004041c

Problem Description

     When I run a report in my Java file using QODBC to connect to QuickBooks, I get the following error:

     java.sql.SQLException: [QODBC] QB Begin Session Failed. Error = 8004041c, An internal QuickBooks error occurred while accessing the QuickBooks company data file.

     And below is the Java code used:

try {
Connection con = DriverManager.getConnection("jdbc:odbc:QuickBooks Data");
Connection con1 = DriverManager.getConnection("jdbc:odbc:ABC");

qrystr="sp_report OpenInvoices show Text, Blank, TxnType, Date, RefNumber, PONumber, Terms, DueDate, Aging, OpenBalance, Memo parameters DateMacro = 'Today'";


     I'm guessing you haven't set unattended mode correctly. Try using QODBC Support Wizard to establish a connection first. See: How to set up QODBC for Auto-login into QuickBooks to add a QuickBooks Data DSN to the specified company file.

     Besides, Java would need a System DSN, and hopefully, you have configured the QODBC DCOMs and have the latest Web server edition of QODBC. And QuickBooks must be closed (not running) when you start your JAVA application.

(166 vote(s))
Not helpful

Comments (3)
20 September 2012 10:21 AM
I installed the 32bit drevir first. Forgot I am using 64bit Windows 7 Home Premium. Then I installed 64bit drevir and uninstalled 32bit drevir rebooted. Now, using Microsoft Access 2007 I get this error when attempting to connect The setup routines for the cubeSQL ODBC ODBC drevir could not be loaded due to system error code 126: The specified module could not be found. (C:\Windows\SysWOW64\\fmodbc32.dll). Any ideas?Brandon
20 September 2012 03:44 PM
Everyone would befneit from reading this post
13 March 2013 02:34 PM
In PHP, I get this error every other time. The script runs fine once, then throws this error the next time without fail. Any idea what may cause that alternating behavior? Sometimes these events are minutes apart, so I don't think it's an issue of overloading quickbooks.
Post a new comment
Full Name:
CAPTCHA Verification 
Please complete the captcha below (we use this to prevent automated submissions).