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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • CiviCRM + Drupal views on different hosts
Pages: [1]

Author Topic: CiviCRM + Drupal views on different hosts  (Read 2022 times)

pike67

  • I post occasionally
  • **
  • Posts: 55
  • Karma: 0
  • CMS version: drupal7
CiviCRM + Drupal views on different hosts
June 06, 2012, 07:59:56 am
Hi

this document
http://wiki.civicrm.org/confluence/display/CRMDOC40/Views3+Integration

describes how to integrate civicrm with drupal views assuming
Quote
CiviCRM and Drupal are on separate databases located on the same physical host

We host the separate databases on different hosts.
Is it at al possible to integrate views3 and civicrm like that ?

curious,
*-pike

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: CiviCRM + Drupal views on different hosts
June 06, 2012, 01:19:19 pm
I still think telling the robots at your host to put your databases on the same server would be worth asking.
Try asking your question on the new CiviCRM help site.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: CiviCRM + Drupal views on different hosts
June 06, 2012, 03:01:13 pm
Quote from: pike67 on June 06, 2012, 07:59:56 am
We host the separate databases on different hosts.
Is it at al possible to integrate views3 and civicrm like that ?

This may be possible, but by using a slightly different method, of defining the CiviCRM DB connect string. I'm not sure where that method is documented however...
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

pike67

  • I post occasionally
  • **
  • Posts: 55
  • Karma: 0
  • CMS version: drupal7
Re: CiviCRM + Drupal views on different hosts
June 07, 2012, 03:03:58 am
Hi Colemanw

thanks for your support
Quote from: colemanw on June 06, 2012, 01:19:19 pm
I still think telling the robots at your host to put your databases on the same server would be worth asking.
I have. I am. The ticket is pending. Just crickets so far :-)

thanks,
*-pike

pike67

  • I post occasionally
  • **
  • Posts: 55
  • Karma: 0
  • CMS version: drupal7
Re: CiviCRM + Drupal views on different hosts
June 07, 2012, 03:11:06 am
Quote
This may be possible, but by using a slightly different method, of defining the CiviCRM DB connect string. I'm not sure where that method is documented however...

If I see the sql that views3 creates, it might work, if only Drupal would switch DB connection just before executing it. Ofcourse, this is just a generic 'get me some contacts with some details' query. Views would never be able to do table joins across different hosts. So even if it is possible, a bit of clicking in the views interface would generate errors...

Nevertheless, and for the record too: it is possible, and how  ?

*-pike

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: CiviCRM + Drupal views on different hosts
June 07, 2012, 03:18:32 am
You can setup multiple database connect strings in Drupal as per http://drupal.org/node/18429

Whether or not you could get Views to work with the secondary DB I'm not sure. You are correct that you can't make a JOIN across DBs, but perhaps if it was all in CiviCRM it could be done.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

pike67

  • I post occasionally
  • **
  • Posts: 55
  • Karma: 0
  • CMS version: drupal7
Re: CiviCRM + Drupal views on different hosts
June 12, 2012, 06:08:17 am
Hi


Quote from: colemanw on June 06, 2012, 01:19:19 pm
I still think telling the robots at your host to put your databases on the same server would be worth asking.

This is what the hosting provider says.

Quote
It's not possible, the host is set randomly by the robots. It's not possible to choose.
I remain at your disposal for any further information.

 ;D I wasn't joking about the robots, you see. I suspect the entity that wrote that mail
is a robot itself. You can't phone these beings either. It's a 100% virtual helpdesk. I wonder where
all the money goes. Grease and diodes, perhaps.

haha,
*-pike
« Last Edit: June 12, 2012, 06:26:29 am by pike67 »

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: CiviCRM + Drupal views on different hosts
June 12, 2012, 06:19:08 am
Quote from: pike67 on June 12, 2012, 06:08:17 am
;D I wasn't joking about the robots, you know. I really suspect the entity that wrote that mail
is a robot itself. You can't phone these beings either. It's a 100% virtual helpdesk. I wonder where
all the money goes.

You could of course consider using another host.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

usaluz

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 7
  • MySQL version: 5.5.20-cll
  • PHP version: 5.3.13
Re: CiviCRM + Drupal views on different hosts
August 08, 2012, 08:48:20 am
I am using two different databases for drupal and civicrm, both have their own credentials. Since i cannot grant privileges to the users, I need to make a separate connection to use the civicrm db.

I don't know how to configure this, i always get an error message.

Now i added this to my settings.php but still drupal will connect to the wrong database with the wrong credentials.


$databases['civicrm']['default']['prefix'] = array (
      'database' => 'civicrm',
      'username' => 'civicrm',
      'password' => 'password',
      'host' => 'localhost',
      'port' => '3306',
      'driver' => 'mysql',
      'prefix' => '',
);
$databases['civicrm']['default']['prefix']= array(
  'database'                   => '`civicrm`',
  'civicrm_acl'                              => '`civicrm`.',
  'civicrm_acl_cache'                        => '`civicrm`.',
  'civicrm_acl_contact_cache'                => '`civicrm`.',
  'civicrm_acl_entity_role'                  => '`civicrm`.',
....
);

The error message I get is:
Base table or view not found: xxxx Table 'drupaldb.civicrm_event' doesn't exist.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: CiviCRM + Drupal views on different hosts
August 08, 2012, 08:52:08 am
Try:

Code: [Select]
$databases['default']['default']['prefix']= array(
  'database'                   => '`civicrm`',
  'civicrm_acl'                              => '`civicrm`.',
  'civicrm_acl_cache'                        => '`civicrm`.',
  'civicrm_acl_contact_cache'                => '`civicrm`.',
  'civicrm_acl_entity_role'                  => '`civicrm`.',
....
);
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

usaluz

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 7
  • MySQL version: 5.5.20-cll
  • PHP version: 5.3.13
Re: CiviCRM + Drupal views on different hosts
August 08, 2012, 09:01:40 am
This doesn't help either.

I get different messages now:

Notice: Undefined offset: 0 in Database::parseConnectionInfo() (line 1507 of /home/httpd/vhosts/krempel.ch/httpdocs/cms/includes/database/database.inc).

SQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'drupal_c'@'localhost' for table 'civicrm_event'

So he tries to connect with the drupal credentials again...

Maybe the error is that two database connections follow each other?


$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'drupal_7',
      'username' => 'drupal_c',
      'password' => 'password',
      'host' => 'localhost',
      'port' => '3306',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);
$databases['civicrm']['default']['prefix'] = array (
      'database' => 'civicrm',
      'username' => 'civicrm',
      'password' => 'password',
      'host' => 'localhost',
      'port' => '3306',
      'driver' => 'mysql',
      'prefix' => '',
);
« Last Edit: August 08, 2012, 09:09:56 am by usaluz »

usaluz

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 7
  • MySQL version: 5.5.20-cll
  • PHP version: 5.3.13
Re: CiviCRM + Drupal views on different hosts
August 08, 2012, 09:21:00 am
Ok, I think I found one part of the problem.

after correcting the second database connection to:
Code: [Select]
$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'drupal_7',
      'username' => 'drupal_c',
      'password' => 'password',
      'host' => 'localhost',
      'port' => '3306',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);
$databases['civicrm']['default'] = array (
      'database' => 'civicrm',
      'username' => 'civicrm',
      'password' => 'password',
      'host' => 'localhost',
      'port' => '3306',
      'driver' => 'mysql',
      'prefix' => '',
);
$databases['default']['default']['prefix']= array(
  'database'                                 => '`civicrm`',
  'civicrm_acl'                              => '`civicrm`.',
  'civicrm_acl_cache'                        => '`civicrm`.',
  'civicrm_acl_contact_cache'                => '`civicrm`.',
  'civicrm_acl_entity_role'                  => '`civicrm`.',
  'civicrm_action_log'                       => '`civicrm`.',
  'civicrm_action_mapping'                   => '`civicrm`.',
...
);

I get the message:
SQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'drupal_c'@'localhost' for table 'civicrm_event'

But the offset notification is gone.

somehow he does not select the right credentials. So I changed the civicrm prefix connection to:

$databases['civicrm']['default']['prefix']

I get the following error message:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal_7.civicrm_event' doesn't exist


So I think the problem is, if I take $databases['civicrm']... he uses the wrong database and if I use 'default' instead he uses the wrong credentials. Can anyone help?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • CiviCRM + Drupal views on different hosts

This forum was archived on 2017-11-26.