Answers.Body: <p>This is because you don't have <code>civicrm_participant</code> as a key in the array defined under CiviCRM Views Integration section. To make sure copy all the tables listed in UF Integration page to <code>settings.php</code> file.</p>
  
  <ol>
  <li>Navigate to Administer -> System Settings -> CMS Database Integration</li>
  <li>Copy and paste the <code>$databases['default']['default']['prefix']</code> array in settings.php file.</li>
  <li>Save and clear the cache of your site.</li>
  </ol>
  
  <p>More Information at : <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Views3+Integration" rel="nofollow">http://wiki.civicrm.org/confluence/display/CRMDOC/Views3+Integration</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-10T19:10:34.393Z
Answers.Text: My bad guys, when I posted
Answers.UserDisplayName: carclubadmin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-10T19:17:28.567Z
Answers.Text: My bad guys, when I posted the settings.php above, I simply posted a snippet. Not the entire file. Yes, my settings.php file does include civic_participant. Keep in mind that no matter what I choose I get the same error regarding a missing table. It's as though View +Civi Integration is completely broken regardless of what is in the settings.php file.
Answers.UserDisplayName: carclubadmin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-10T22:24:10.287Z
Answers.Text: Is Civi in a separate database from Drupal?
Answers.UserDisplayName: pmoz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-10T07:40:42.190Z
Answers.LastActivityDate: 2015-11-10T07:40:42.190Z
Answers.UserDisplayName: jitendra - fuzion
Answers.Body: <p>I noticed something else.</p>
  
  <p>Your code contains:</p>
  
  <p>/** CiviCRM Views Integration</p>
  
  <p>Where /* is the START of a php comment, but I see no end of the comment.
  If it is like that in your settings.php then everything after this is a comment to php, until the next */
  And that would include your whole $databases['default']['default']['prefix'] array;</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-12T17:57:28.873Z
Answers.Text: Holy Hit Myself in the Head with a Shovel. Jeez. Let me look at that right now.
Answers.UserDisplayName: carclubadmin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-12T16:50:04.313Z
Answers.LastActivityDate: 2015-11-12T16:50:04.313Z
Answers.UserDisplayName: Catorghans
Answers.Body: <p>In views you can have the SQL be shown.</p>
  
  <p>Are you able to run that sql when you login into the drupal database with the drupal login credentials?</p>
  
  <p>Likely you can not but that would often give more information about what is wrong.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-11T15:46:36.053Z
Answers.Text: That's a great tip and it may have helped get me to where I need to go. I've given the Show SQL a try and something very interesting has shown up. Please see my question at the top. The comment format doesn't allow me to use the <code> tag so I had to add information to the original question. Thanks.
Answers.UserDisplayName: carclubadmin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-11T10:20:40.550Z
Answers.LastActivityDate: 2015-11-11T10:20:40.550Z
Answers.UserDisplayName: Catorghans
Answers.Body: <p>Yes, that was the problem. I forgot the ending */</p>
  
  <p>I just donated $25 (about $9000 Canadian) to CiviCRM. My 'dumb' tax. It's like a swear jar. But if I had to contribute to that over the last few days CiviCRM probably would have met their $200,000 goal.</p>
  
  <p>Why do computers do what they're told to do and not what we intended them to do?</p>
  
  <p>Thanks all. All tips provided great help in getting to know more about CiviCRM.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-12T18:07:55.210Z
Answers.LastActivityDate: 2015-11-12T18:16:49.027Z
Answers.LastEditDate: 2015-11-12T18:16:49.027Z
Answers.UserDisplayName: carclubadmin
Answers.Body: <p>Drupal caches can be the issue here. Trying clearing them then refreshing the View.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-11T05:12:28.523Z
Answers.Text: Gave cache clearing a try but no luck unfortunately. Cleared Civi caches as well. Same result. Is there a way to debug the problem? I checked my mysql.log and mysql.error.log file and found nothing. Could I be missing a module or have left something disabled?
Answers.UserDisplayName: carclubadmin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-11T05:53:10.617Z
Answers.Text: During an update of Views I got multiple errors of the form "Notice: Undefined index: admin/structure/types/manage/civicrm_activity/fields in civicrm_entity_menu_alter() (line 23 of /home/mysite/www/www/sites/all/modules/civicrm_entity/civicrm_entity.module)." I fixed this problem using the following link (https://www.drupal.org/node/2564757#comment-10498976) and patching /var/www/drupal/sites/all/modules/civicrm_entity/civicrm_entity.module. Still no luck though. Darn.
Answers.UserDisplayName: carclubadmin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-11T09:31:31.913Z
Answers.Text: sorry no other ideas. ah one other thing. i have noticed that there are often double ups of 'fields' in the list of fields in Views and for example there will be both "CiviCRM Contacts: Gender Error: missing help"
  AND "CiviCRM Contacts: Gender: Contact's Gender" and that choosing a field with the 'error missing help' is likely to generate an sql issue
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-11T22:04:17.723Z
Answers.Text: I am using CiviCRM Entities 7.x-2.0-beta1, the job of which is to "Declare CiviCRM entities as Drupal entities". I wonder if that is the problem
Answers.UserDisplayName: carclubadmin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-12T01:26:26.767Z
Answers.Text: you don't need CivICRM Entities just to make Views work with civi data.
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-10T20:02:08.120Z
Answers.LastActivityDate: 2015-11-10T20:02:08.120Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>Yours looks slightly different than mine and I wonder if that could in any way be causing the issue. I am assuming your database just has a name and isn't formatted like this: username_databasename which is how my server requires my databases to be called.</p>
  
  <p>$databases['default']['default']['prefix']= array(
    'default' => '',
    'civicrm_acl'                              => '<code>databasename</code>.',</p>
  
  <p>Notice that mine doesn't have a space and it has extra punctuation before the name of the database begins.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-12T05:50:31.963Z
Answers.Text: Good eye spotting that. Odd it shows a space. I just checked the settings.php file and discovered it actually 'civicrm_acl' => 'backtickcivicrmbacktick.' The civicrm is surrounded by backticks but when It try to post them it comes out as a space
Answers.UserDisplayName: carclubadmin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-12T13:48:07.057Z
Answers.Text: I removed the back ticks/quotes and . .  it still doesn't work. Arrrrgggg. Even with fingers crossed on both hands it still seems to be a problem. Question: Are you using CiviCRM Entities?
Answers.UserDisplayName: carclubadmin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-15T23:11:44.787Z
Answers.Text: No, I'm not. I wonder if that is what is causing your issues, then.
Answers.UserDisplayName: Jenni Simonis
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-12T03:38:03.107Z
Answers.LastActivityDate: 2015-11-12T03:38:03.107Z
Answers.UserDisplayName: Jenni Simonis
Body: <p>Drupal 7.41
  CiviCRM: 4.6.9</p>
  
  <p>Hi, new to CiviCRM and Drupal. Maybe I'm overlooking something but no matter what I try I cannot create a View from Drupal of any Civi data structure. For example, to show whether a logged in user is registered for a CiviEvent, I want to create a view of Civi_Participant but get the error:</p>
  
  <p><code>Base table or view not found: 1146 Table 'drupal.civicrm_participant' doesn't exist</code></p>
  
  <p>Check setting.php file (a snippet of which is below). Looks fine. Prefix is set to nothing but that shouldn't be a problem since default is properly set:</p>
  
  <p><code>
  $databases = array (
    'default' =>
    array (
      'default' =>
      array (
        'database' => 'drupal',
        'username' => 'dpal',
        'password' => '*********',
        'host' => 'localhost',
        'port' => '',
        'driver' => 'mysql',
        'prefix' => '',
      ),
    ),
  );</p>
  
  <p>/** CiviCRM Views Integration
  $databases['default']['default']['prefix']= array(
    'default' => '',
    'civicrm_acl'                              => '<code>civicrm</code>.',
    'civicrm_acl_cache'                        => '<code>civicrm</code>.',
    'civicrm_acl_contact_cache'                => '<code>civicrm</code>.',
    'civicrm_acl_entity_role'                  => '<code>civicrm</code>.',
  </code></p>
  
  <p>Forgot to grant the drupal user SELECT access to the civicrm database? Don't think so. From mysql command line:</p>
  
  <p><code>
  mysql> SHOW GRANTS for dpal@localhost;
  Grants for dpal@localhost                                                                 |
  | GRANT ALL PRIVILEGES ON <em>.</em> TO 'dpal'@'localhost' IDENTIFIED BY PASSWORD 
  | GRANT SELECT ON <code>civicrm</code>.* TO 'dpal'@'localhost'<br>
  </code></p>
  
  <p>I tried another example where I tried to select civicrm_contact and selected the 'Show SQL' option for my view. I get:</p>
  
  <p><code>
  SELECT civicrm_contact.id AS id
  FROM 
  {civicrm_contact} civicrm_contact
  LIMIT 10 OFFSET 0
  </code></p>
  
  <p>I'm no SQL pro by any means but how does that query address the database civicrm? Where's the reference to the database? This is why I get the error:</p>
  
  <p><code>Table 'drupal.civicrm_contact' doesn't exist</code></p>
  
  <p>Views is defaulting to the Drupal database, not the civicrm database even when selecting Show CiviCRM Contact, or CiviCRM Participants or CiviCRM PrettyMuchAnythingElse. How do I fix that?</p>
  
  <p>I tried a query from mysql directly and this works:</p>
  
  <p><code>SELECT civicrm_contact.id AS id FROM civicrm.civicrm_contact;</code></p>
  
  <p>How do I get drupal to do that? What are those kooky curly brackets. {civicrm_contact} .... Is that wrong?</p>
  
  <p>Just in case you are wondering, yes, I am being driven crazy by this problem</p>
  
Tags: <drupal><drupal-views>
Title: Cannot create CiviCRM view in Drupal "Error: Base table or view not found: 1146 Table drupal.civicrm
ThreadText: # Cannot create CiviCRM view in Drupal "Error: Base table or view not found: 1146 Table drupal.civicrm
  
  (Asked by: username_0 on 2015-11-10)
  
  Drupal 7.41
  CiviCRM: 4.6.9
  
  Hi, new to CiviCRM and Drupal. Maybe I'm overlooking something but no matter what I try I cannot create a View from Drupal of any Civi data structure. For example, to show whether a logged in user is registered for a CiviEvent, I want to create a view of Civi\_Participant but get the error:
  
  `Base table or view not found: 1146 Table 'drupal.civicrm_participant' doesn't exist`
  
  Check setting.php file (a snippet of which is below). Looks fine. Prefix is set to nothing but that shouldn't be a problem since default is properly set:
  
  `$databases = array (
  'default' =>
  array (
  'default' =>
  array (
  'database' => 'drupal',
  'username' => 'dpal',
  'password' => '*********',
  'host' => 'localhost',
  'port' => '',
  'driver' => 'mysql',
  'prefix' => '',
  ),
  ),
  );`
  
  /\*\* CiviCRM Views Integration
  $databases['default']['default']['prefix']= array(
  'default' => '',
  'civicrm\_acl' => '`civicrm`.',
  'civicrm\_acl\_cache' => '`civicrm`.',
  'civicrm\_acl\_contact\_cache' => '`civicrm`.',
  'civicrm\_acl\_entity\_role' => '`civicrm`.',
  
  Forgot to grant the drupal user SELECT access to the civicrm database? Don't think so. From mysql command line:
  
  `mysql> SHOW GRANTS for dpal@localhost;
  Grants for dpal@localhost |
  | GRANT ALL PRIVILEGES ON . TO 'dpal'@'localhost' IDENTIFIED BY PASSWORD
  | GRANT SELECT ON civicrm.* TO 'dpal'@'localhost'`
  
  I tried another example where I tried to select civicrm\_contact and selected the 'Show SQL' option for my view. I get:
  
  `SELECT civicrm_contact.id AS id
  FROM
  {civicrm_contact} civicrm_contact
  LIMIT 10 OFFSET 0`
  
  I'm no SQL pro by any means but how does that query address the database civicrm? Where's the reference to the database? This is why I get the error:
  
  `Table 'drupal.civicrm_contact' doesn't exist`
  
  Views is defaulting to the Drupal database, not the civicrm database even when selecting Show CiviCRM Contact, or CiviCRM Participants or CiviCRM PrettyMuchAnythingElse. How do I fix that?
  
  I tried a query from mysql directly and this works:
  
  `SELECT civicrm_contact.id AS id FROM civicrm.civicrm_contact;`
  
  How do I get drupal to do that? What are those kooky curly brackets. {civicrm\_contact} .... Is that wrong?
  
  Just in case you are wondering, yes, I am being driven crazy by this problem
  
  **Tags:** drupal, drupal-views
  
  
  ---
  
  ## 6 answers
  
  ### Answer by username_3 on 2015-11-12. Score: 0 | Accepted answer
  
  I noticed something else.
  
  Your code contains:
  
  /\*\* CiviCRM Views Integration
  
  Where /\* is the START of a php comment, but I see no end of the comment.
  If it is like that in your settings.php then everything after this is a comment to php, until the next \*/
  And that would include your whole $databases['default']['default']['prefix'] array;
  
  > **Comments:**
  > **username_0**: Holy Hit Myself in the Head with a Shovel. Jeez. Let me look at that right now.  
  
  ---
  
  ### Answer by username_1 on 2015-11-10. Score: 4
  
  This is because you don't have `civicrm_participant` as a key in the array defined under CiviCRM Views Integration section. To make sure copy all the tables listed in UF Integration page to `settings.php` file.
  
  1. Navigate to Administer -> System Settings -> CMS Database Integration
  2. Copy and paste the `$databases['default']['default']['prefix']` array in settings.php file.
  3. Save and clear the cache of your site.
  
  More Information at : <http://wiki.civicrm.org/confluence/display/CRMDOC/Views3+Integration>
  
  > **Comments:**
  > **username_0**: My bad guys, when I posted  
  > **username_0**: My bad guys, when I posted the settings.php above, I simply posted a snippet. Not the entire file. Yes, my settings.php file does include civic_participant. Keep in mind that no matter what I choose I get the same error regarding a missing table. It's as though View +Civi Integration is completely broken regardless of what is in the settings.php file.  
  > **username_2**: Is Civi in a separate database from Drupal?  
  
  ---
  
  ### Answer by username_3 on 2015-11-11. Score: 1
  
  In views you can have the SQL be shown.
  
  Are you able to run that sql when you login into the drupal database with the drupal login credentials?
  
  Likely you can not but that would often give more information about what is wrong.
  
  > **Comments:**
  > **username_0**: That's a great tip and it may have helped get me to where I need to go. I've given the Show SQL a try and something very interesting has shown up. Please see my question at the top. The comment format doesn't allow me to use the <code> tag so I had to add information to the original question. Thanks.  
  
  ---
  
  ### Answer by username_0 on 2015-11-12. Score: 1
  
  Yes, that was the problem. I forgot the ending \*/
  
  I just donated $25 (about $9000 Canadian) to CiviCRM. My 'dumb' tax. It's like a swear jar. But if I had to contribute to that over the last few days CiviCRM probably would have met their $200,000 goal.
  
  Why do computers do what they're told to do and not what we intended them to do?
  
  Thanks all. All tips provided great help in getting to know more about CiviCRM.
  
  
  ---
  
  ### Answer by username_4 on 2015-11-10. Score: 0
  
  Drupal caches can be the issue here. Trying clearing them then refreshing the View.
  
  > **Comments:**
  > **username_0**: Gave cache clearing a try but no luck unfortunately. Cleared Civi caches as well. Same result. Is there a way to debug the problem? I checked my mysql.log and mysql.error.log file and found nothing. Could I be missing a module or have left something disabled?  
  > **username_0**: During an update of Views I got multiple errors of the form "Notice: Undefined index: admin/structure/types/manage/civicrm_activity/fields in civicrm_entity_menu_alter() (line 23 of /home/mysite/www/www/sites/all/modules/civicrm_entity/civicrm_entity.module)." I fixed this problem using the following link (https://www.drupal.org/node/2564757#comment-10498976) and patching /var/www/drupal/sites/all/modules/civicrm_entity/civicrm_entity.module. Still no luck though. Darn.  
  > **username_4**: sorry no other ideas. ah one other thing. i have noticed that there are often double ups of 'fields' in the list of fields in Views and for example there will be both "CiviCRM Contacts: Gender Error: missing help" AND "CiviCRM Contacts: Gender: Contact's Gender" and that choosing a field with the 'error missing help' is likely to generate an sql issue  
  > **username_0**: I am using CiviCRM Entities 7.x-2.0-beta1, the job of which is to "Declare CiviCRM entities as Drupal entities". I wonder if that is the problem  
  > **username_4**: you don't need CivICRM Entities just to make Views work with civi data.  
  
  ---
  
  ### Answer by username_5 on 2015-11-12. Score: 0
  
  Yours looks slightly different than mine and I wonder if that could in any way be causing the issue. I am assuming your database just has a name and isn't formatted like this: username\_databasename which is how my server requires my databases to be called.
  
  $databases['default']['default']['prefix']= array(
  'default' => '',
  'civicrm\_acl' => '`databasename`.',
  
  Notice that mine doesn't have a space and it has extra punctuation before the name of the database begins.
  
  > **Comments:**
  > **username_0**: Good eye spotting that. Odd it shows a space. I just checked the settings.php file and discovered it actually 'civicrm_acl' => 'backtickcivicrmbacktick.' The civicrm is surrounded by backticks but when It try to post them it comes out as a space  
  > **username_0**: I removed the back ticks/quotes and . .  it still doesn't work. Arrrrgggg. Even with fingers crossed on both hands it still seems to be a problem. Question: Are you using CiviCRM Entities?  
  > **username_5**: No, I'm not. I wonder if that is what is causing your issues, then.  
  
  ---
  
  