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 CiviMail (Moderator: Piotr Szotkowski) »
  • DB Error: No database selected when running cron
Pages: [1]

Author Topic: DB Error: No database selected when running cron  (Read 1955 times)

adams780

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.4
  • CMS version: Drupal 7.22
  • MySQL version: 5.1.68
  • PHP version: 5.3.27
DB Error: No database selected when running cron
October 31, 2013, 05:46:23 pm
I've trying to send a scheduled mailing using civimail installed on Drupal 7.  When I try to run cron through a URL, I get the following Error:
DB Error: No database selected.
I've checked and double-checked civicrm.settings.php, and I'm pretty sure my drupal database in my civicrm databases are both defined properly.
Can anything else be causing this error that I haven't thought of?

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: DB Error: No database selected when running cron
November 02, 2013, 02:43:47 pm
Post the URL for us, without the real password and key.
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.

adams780

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.4
  • CMS version: Drupal 7.22
  • MySQL version: 5.1.68
  • PHP version: 5.3.27
Re: DB Error: No database selected when running cron
November 04, 2013, 05:32:49 pm
This is the URL I used:
http://www.mysite.com/sites/all/modules/civicrm/bin/cron.php?job=process_mailing&name=myname&pass=mypass&key=xxxxxxxxxmykeyxxxxxxxxxxxxxxxxxx

Thanks!

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: DB Error: No database selected when running cron
November 04, 2013, 05:46:56 pm

might want to try cli.php, this is becoming more the default for running all command line stuff in civi

seems like we might want to deprecate cron.php

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: DB Error: No database selected when running cron
November 05, 2013, 03:09:58 am
Quote from: adams780 on November 04, 2013, 05:32:49 pm
http://www.mysite.com/sites/all/modules/civicrm/bin/cron.php?job=process_mailing&name=myname&pass=mypass&key=xxxxxxxxxmykeyxxxxxxxxxxxxxxxxxx

Perhaps try removing the job=process_mailing& part and see if that helps. A long shot, but it won't hurt. :)

Quote from: Donald Lobo on November 04, 2013, 05:46:56 pm
seems like we might want to deprecate cron.php

I would hesitate to suggest that as it's useful in many cases for debugging--it's easier for some users (and some host setups) to put the URL in the browser and easily see what error message is returned. The other reason to keep it is that I think it's easier for many users to build the URL then to construct the CLI cron job.
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.

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: DB Error: No database selected when running cron
November 05, 2013, 03:06:14 pm
are you using prefixes in your database?  I think that CiviCRM doesn't know where to look to authenticate the user attempting to run cron.

Check your CMS integration settings in CiviCRM, make sure the "users" table is defined properly.
Try CiviTeacher: the online video tutorial CiviCRM learning library.

adams780

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.4
  • CMS version: Drupal 7.22
  • MySQL version: 5.1.68
  • PHP version: 5.3.27
Re: DB Error: No database selected when running cron
November 05, 2013, 04:15:46 pm
Thanks for your suggestions:
(1) I have a control panel with my host provider -- but I don't think I can run command lines directly.  That is why I was trying to use the URL method.
(2) Removing the job=process_mailing& part yields the same result.
(3) My CMS integration settings in CiviCRM matches correctly with my drupal database:   The drupal users table name is "users."  Check.

Also, if I try to Send the scheduled mailings from the Civicrm Administer menu, it returns the below error.  Right now I have no way to send mail using civimail, even brute force.

Uncaught exception thrown in session handler.

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in _drupal_session_write() (line 209 of /mypath/mysite.com/includes/session.inc).

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: DB Error: No database selected when running cron
November 05, 2013, 05:11:10 pm

curious as to who your hosting provider is? might give us a few more clues :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: DB Error: No database selected when running cron
November 06, 2013, 02:56:34 am
Quote from: adams780 on November 05, 2013, 04:15:46 pm
Also, if I try to Send the scheduled mailings from the Civicrm Administer menu, it returns the below error.  Right now I have no way to send mail using civimail, even brute force.

Uncaught exception thrown in session handler.

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in _drupal_session_write() (line 209 of /mypath/mysite.com/includes/session.inc).

Appears clear now that your host machine is not able to handle this procedure. You should ask them for assistance and if they can't help, you will need to find alternative hosting. The reason you get "No database selected" is because "MySQL server has gone away."  Certainly appears to be anyhow, and this is a hosting problem.
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.

adams780

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.4
  • CMS version: Drupal 7.22
  • MySQL version: 5.1.68
  • PHP version: 5.3.27
Re: DB Error: No database selected when running cron
November 06, 2013, 03:24:56 pm
Thanks.  My hosting provider is Inmotionhosting.com.  I will submit a ticket with them.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • DB Error: No database selected when running cron

This forum was archived on 2017-11-26.