diff --git a/src/sreport/sreport.c b/src/sreport/sreport.c
index a96efb50435413e2a8d8fa1f1d8493450b6c6362..a58998f06594d00c7f306e611a7f603e77f79a59 100644
--- a/src/sreport/sreport.c
+++ b/src/sreport/sreport.c
@@ -178,6 +178,10 @@ main (int argc, char *argv[])
 	}
 
 	db_conn = acct_storage_g_get_connection(false, 0, false);
+	if(errno) {
+		error("Problem talking to the database: %m");
+		exit(1);
+	}
 	my_uid = getuid();
 
 	if (input_field_count)