CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • views 3 not select table from civicrm database
Pages: [1]

Author Topic: views 3 not select table from civicrm database  (Read 2868 times)

ouyang1512

  • I post occasionally
  • **
  • Posts: 59
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7.12
  • MySQL version: MySQL 5.1.52
  • PHP version: 5.3.6
views 3 not select table from civicrm database
December 01, 2011, 08:33:13 am
I have civicrm 4.0.7 installed with drupal 7.8, and I followed the views3 and drupal integration instructions, copy and paste the code into settings.php.
I was successfully synchronized users to contacts after the integration. Now I want to create an civi events view in drupal using views 3, but got an error:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mysite_drupal.drupalDBprevixcivicrm_event' doesn't exist


I tried to create other civi related views, all showed me that the views is not selecting table from civicrm, instead, it is try to find the table from my drupal database (I have two separate databases for civicrm and drupal).

Do anybody know what's wrong here? Thank you!

msn

  • I post frequently
  • ***
  • Posts: 152
  • Karma: 6
  • Please talk to the other site
Re: views 3 not select table from civicrm database
December 01, 2011, 12:46:57 pm
Try a new view with a CiviCRM contacts setup (not a node related).
You can show user data by making a user id relationship in the view.

Worked for me

ouyang1512

  • I post occasionally
  • **
  • Posts: 59
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7.12
  • MySQL version: MySQL 5.1.52
  • PHP version: 5.3.6
Re: views 3 not select table from civicrm database
December 02, 2011, 07:19:02 am
Thanks for your suggestions, msn! But I really want this works normally because I need to create a few views from civicrm content. Do you have two separate db? Does you drupal db user have select privilege in civicrm db if you did set up two dbs? I am trying to find out what the problem is...

msn

  • I post frequently
  • ***
  • Posts: 152
  • Karma: 6
  • Please talk to the other site
Re: views 3 not select table from civicrm database
December 02, 2011, 08:51:24 am
I have 2 db's. Database admin: Drupal_db with user drupal and CiviCRM_db with user drupal (because of views and webform integration) and user civicrm.

I had the same error after making a new specific field, for each (!) field you must have a relation in setting.php http://wiki.civicrm.org/confluence/display/CRMDOC40/Views3+Integration

 

ouyang1512

  • I post occasionally
  • **
  • Posts: 59
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7.12
  • MySQL version: MySQL 5.1.52
  • PHP version: 5.3.6
Re: views 3 not select table from civicrm database
December 02, 2011, 12:11:06 pm
Thank you, msn! I too have two dbs, and I pasted this code in settings.php:
Code: [Select]
/**drupal 7 and civicrm views integration*/
$databases['default']['default']['prefix']= array(
  'default'                                  => 'cmdr7',
  'civicrm_acl'                              => '`mysite_civicrm`.',
  'civicrm_acl_cache'                        => '`mysite_civicrm`.',
  'civicrm_acl_contact_cache'                => '`mysite_civicrm`.',
  'civicrm_acl_entity_role'                  => '`mysite_civicrm`.',
  'civicrm_action_log'                       => '`mysite_civicrm`.',
  'civicrm_action_mapping'                   => '`mysite_civicrm`.',
  'civicrm_action_schedule'                  => '`mysite_civicrm`.',
  'civicrm_activity'                         => '`mysite_civicrm`.',
.....
  'civicrm_worldregion'                      => '`mysite_civicrm`.',
);
 

AFTER
Code: [Select]
$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'mysite_drupal',
      'username' => 'myusername',
      'password' => 'mypassword',
      'host' => 'myaddress',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => 'cmdr7',
    ),
  ),
);

I also check with my db admin, the drupal user does have select permission over the civicrm database. I could not find what's wrong here:(

msn

  • I post frequently
  • ***
  • Posts: 152
  • Karma: 6
  • Please talk to the other site
Re: views 3 not select table from civicrm database
December 02, 2011, 04:29:01 pm
Can you make a new CiviCRM view, see attachment

ouyang1512

  • I post occasionally
  • **
  • Posts: 59
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7.12
  • MySQL version: MySQL 5.1.52
  • PHP version: 5.3.6
Re: views 3 not select table from civicrm database
December 15, 2011, 11:20:02 am
Thanks for your response. I can add a new view and all civicrm content type shown on the list (see the attachment), but could not get anything in the next step (pic 2 below).
I noticed that the system was looking for the civicrm_contact table in drupal database, rather than in civicrm database. My db admin told me he had already assigned the DB user all privileges in both DBs (drupal and civicrm). Any suggestions/ideas?

Thank you!
« Last Edit: December 15, 2011, 11:28:57 am by ouyang1512 »

msn

  • I post frequently
  • ***
  • Posts: 152
  • Karma: 6
  • Please talk to the other site
Re: views 3 not select table from civicrm database
December 15, 2011, 11:42:23 am
Wat is the real database prefix?
Your setting in settings.php is 'cmdr7'
The SQL is searching for: 'citymatch_drupal.cmdr7civicrm_contact' prefix='citymatch_drupal.cmdr7'

I don't use a prefix so my setting.php has no line:   'default'  => 'prefix_ text',


ouyang1512

  • I post occasionally
  • **
  • Posts: 59
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7.12
  • MySQL version: MySQL 5.1.52
  • PHP version: 5.3.6
Re: views 3 not select table from civicrm database
December 15, 2011, 01:35:41 pm
The drupal database's prefix is cmdr7, civicrm database does not have a prefix.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • views 3 not select table from civicrm database

This forum was archived on 2017-11-26.