diff -urN gnucash-2.4.7/src/backend/dbi/gnc-backend-dbi.c gnucash-2.4.7-patched/src/backend/dbi/gnc-backend-dbi.c
--- gnucash-2.4.7/src/backend/dbi/gnc-backend-dbi.c	2011-07-02 15:35:04.000000000 -0400
+++ gnucash-2.4.7-patched/src/backend/dbi/gnc-backend-dbi.c	2011-09-17 18:34:50.335258268 -0400
@@ -137,7 +137,7 @@
         const gchar* table_name,
         GList* col_info_list );
 static GncSqlConnection* create_dbi_connection( /*@ observer @*/ provider_functions_t* provider, /*@ observer @*/ QofBackend* qbe, /*@ observer @*/ dbi_conn conn );
-static gboolean conn_test_dbi_library( dbi_conn conn );
+static gboolean conn_test_dbi_library( QofBackend *qbe, dbi_conn conn );
 #define GNC_DBI_PROVIDER_SQLITE (&provider_sqlite3)
 #define GNC_DBI_PROVIDER_MYSQL (&provider_mysql)
 #define GNC_DBI_PROVIDER_PGSQL (&provider_pgsql)
@@ -314,10 +314,8 @@
         goto exit;
     }
 
-    if ( !conn_test_dbi_library( be->conn ) )
+    if ( !conn_test_dbi_library( qbe, be->conn ) )
     {
-        qof_backend_set_error( qbe, ERR_SQL_BAD_DBI );
-        qof_backend_set_message( qbe, "DBI library fails large number test" );
         if ( create && !file_exists ) /* File didn't exist before, but it */
         {
             /* does now, and we don't want to */
@@ -769,11 +767,8 @@
     result = dbi_conn_connect( be->conn );
     if ( result == 0 )
     {
-        if ( !conn_test_dbi_library( be->conn ) )
+        if ( !conn_test_dbi_library( qbe, be->conn ) )
         {
-            qof_backend_set_error( qbe, ERR_SQL_BAD_DBI );
-            qof_backend_set_message( qbe,
-                                     "DBI library fails large number test" );
             goto exit;
         }
         if (create && !force && save_may_clobber_data( qbe ) )
@@ -842,11 +837,8 @@
                 qof_backend_set_error( qbe, ERR_BACKEND_SERVER_ERR );
                 goto exit;
             }
-            if ( !conn_test_dbi_library( be->conn ) )
+            if ( !conn_test_dbi_library( qbe, be->conn ) )
             {
-                qof_backend_set_error( qbe, ERR_SQL_BAD_DBI );
-                qof_backend_set_message( qbe,
-                                         "DBI library fails large number test" );
                 dbi_conn_queryf( be->conn, "DROP DATABASE %s", dbname );
                 goto exit;
             }
@@ -1048,11 +1040,8 @@
     result = dbi_conn_connect( be->conn );
     if ( result == 0 )
     {
-        if ( !conn_test_dbi_library( be->conn ) )
+        if ( !conn_test_dbi_library( qbe, be->conn ) )
         {
-            qof_backend_set_error( qbe, ERR_SQL_BAD_DBI );
-            qof_backend_set_message( qbe,
-                                     "DBI library fails large number test" );
             goto exit;
         }
         if (create && !force && save_may_clobber_data( qbe ) )
@@ -1122,11 +1111,8 @@
                 qof_backend_set_error( qbe, ERR_BACKEND_SERVER_ERR );
                 goto exit;
             }
-            if ( !conn_test_dbi_library( be->conn ) )
+            if ( !conn_test_dbi_library( qbe, be->conn ) )
             {
-                qof_backend_set_error( qbe, ERR_SQL_BAD_DBI );
-                qof_backend_set_message( qbe,
-                                         "DBI library fails large number test" );
                 dbi_conn_select_db( be->conn, "template1" );
                 dbi_conn_queryf( be->conn, "DROP DATABASE %s", dbnamelc );
                 goto exit;
@@ -2896,12 +2882,14 @@
 /** Users discovered a bug in some distributions of libdbi, where if
  * it is compiled on certain versions of gcc with the -ffast-math
  * compiler option it fails to correctly handle saving of 64-bit
- * values. This function tests for the problem.
+ * values. This function tests for the problem and sets the Qof backend
+ * error and message if necessary.
  * @param: conn: The just-opened dbi_conn
- * @returns: TRUE if the dbi library is safe to use, FALSE otherwise.
+ * @returns: TRUE if the dbi library is safe to use, FALSE otherwise,
+ * including if the test could not be completed.
  */
 static gboolean
-conn_test_dbi_library( dbi_conn conn )
+conn_test_dbi_library( QofBackend *qbe, dbi_conn conn )
 {
     gint64 testlonglong = -9223372036854775807LL, resultlonglong = 0;
     guint64 testulonglong = 9223372036854775807LLU, resultulonglong = 0;
@@ -2917,7 +2905,8 @@
     if ( result == NULL )
     {
         PWARN("Test_DBI_Library: Create table failed");
-        return FALSE;
+        retval = FALSE;
+        goto incomplete;
     }
     dbi_result_free( result );
     g_ascii_dtostr( doublestr, sizeof(doublestr), testdouble );
@@ -2929,7 +2918,8 @@
     if ( result == NULL )
     {
         PWARN("Test_DBI_Library: Failed to insert test row into table" );
-        return FALSE;
+        retval = FALSE;
+        goto incomplete;
     }
     dbi_result_free( result );
     gnc_push_locale( LC_NUMERIC, "C");
@@ -2941,8 +2931,18 @@
         PWARN("Test_DBI_Library: Failed to retrieve test row into table: %s",
               errmsg );
         result = dbi_conn_query( conn, "DROP TABLE numtest" );
-        return FALSE;
+        retval = FALSE;
+        goto incomplete;
+    }
+
+incomplete:
+    if ( FALSE == retval )
+    {
+        qof_backend_set_error( qbe, ERR_SQL_DBI_UNTESTABLE );
+        qof_backend_set_message( qbe, "DBI library large number test incomplete" );
+        goto exit;
     }
+
     while ( dbi_result_next_row( result ))
     {
         resultlonglong = dbi_result_get_longlong( result, "test_int" );
@@ -2970,6 +2970,14 @@
                testdouble, resultdouble );
         retval = FALSE;
     }
+
+    if ( FALSE == retval )
+    {
+        qof_backend_set_error( qbe, ERR_SQL_BAD_DBI );
+        qof_backend_set_message( qbe, "DBI library fails large number test" );
+    }
+
+exit:
     return retval;
 }
 
diff -urN gnucash-2.4.7/src/gnome-utils/gnc-file.c gnucash-2.4.7-patched/src/gnome-utils/gnc-file.c
--- gnucash-2.4.7/src/gnome-utils/gnc-file.c	2011-07-02 12:57:48.000000000 -0400
+++ gnucash-2.4.7-patched/src/gnome-utils/gnc-file.c	2011-09-17 18:34:50.375259080 -0400
@@ -447,6 +447,17 @@
         gnc_error_dialog (parent, "%s", fmt);
         break;
 
+    case ERR_SQL_DBI_UNTESTABLE:
+
+        fmt = _("GnuCash could not complete a critical test for the presence of "
+                "a bug in the \"libdbi\" library. This may be caused by a "
+                "permissions misconfiguration of your SQL database. Please see "
+                "https://bugzilla.gnome.org/show_bug.cgi?id=645216 for more "
+                "information.");
+
+        gnc_error_dialog (parent, "%s", fmt);
+        break;
+
     default:
         PERR("FIXME: Unhandled error %d", io_error);
         fmt = _("An unknown I/O error (%d) occurred.");
diff -urN gnucash-2.4.7/src/libqof/qof/qofbackend.h gnucash-2.4.7-patched/src/libqof/qof/qofbackend.h
--- gnucash-2.4.7/src/libqof/qof/qofbackend.h	2011-07-02 15:35:04.000000000 -0400
+++ gnucash-2.4.7-patched/src/libqof/qof/qofbackend.h	2011-09-17 18:34:50.375259080 -0400
@@ -110,6 +110,7 @@
     ERR_SQL_DB_TOO_NEW,		  /**< database is newer, we can't write to it */
     ERR_SQL_DB_BUSY,              /**< database is busy, cannot upgrade version */
     ERR_SQL_BAD_DBI,		  /**< LibDBI has numeric errors */
+    ERR_SQL_DBI_UNTESTABLE,       /**< could not complete test for LibDBI bug */
 
     /* RPC errors */
     ERR_RPC_HOST_UNK = 4000,      /**< Host unknown */
