Yii Framework Forum: CDbException - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CDbException Error is coming during installation of user management extension. Rate Topic: ****- 1 Votes

#1 User is offline   manis 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 30-May 12

Posted 01 June 2012 - 03:41 PM

Hi,

I am newbie in Yii. And during installation of Yii extension User Management but during this I am getting this error. Please help me I am not getting installation page. I have followed all steps given in tutorial.


CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'testdrive.translation' doesn't exist. The SQL statement executed was: select message, translation from translation where language = :language and category = :category

/opt/lampp/htdocs/yii/framework/db/CDbCommand.php(528)

516 return $result;
517 }
518 catch(Exception $e)
519 {
520 if($this->_connection->enableProfiling)
521 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
522 $errorInfo = $e instanceof PDOException ? $e->errorInfo : null;
523 $message = $e->getMessage();
524 Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
525 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
526 if(YII_DEBUG)
527 $message .= '. The SQL statement executed was: '.$this->getText().$par;
528 throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
529 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
530 }
531 }
532
533 /**
534 * Builds a SQL SELECT statement from the given query specification.
535 * @param array $query the query specification in name-value pairs. The following
536 * query options are supported: {@link select}, {@link distinct}, {@link from},
537 * {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
538 * {@link limit}, {@link offset} and {@link union}.
539 * @return string the SQL statement
540 * @since 1.1.6
Stack Trace
#0
+ /opt/lampp/htdocs/yii/framework/db/CDbCommand.php(390): CDbCommand->queryInternal("fetchAll", array(2), array())
#1
– /opt/lampp/htdocs/mydemo/protected/modules/user/models/Yum.php(131): CDbCommand->queryAll()
126 $command=Yii::app()->db->createCommand($sql);
127 $command->bindValue(':category',$category);
128 $command->bindValue(':language',$language);
129
130 $messages=array();
131 foreach($command->queryAll() as $row)
132 $messages[$row['message']]=$row['translation'];
133 }
134
135 if(Yii::app()->cache)
136 Yii::app()->cache->set($cache_id, $messages);
#2
– /opt/lampp/htdocs/mydemo/protected/modules/user/controllers/YumInstallController.php(459): Yum::t("User management module is not in Debug Mode")
454 'friendshipTable' => Yum::resolveTableName($this->module->friendshipTable, Yii::app()->db),
455 'actionTable' => Yum::resolveTableName($this->module->actionTable, Yii::app()->db),
456 ));
457 }
458 } else {
459 throw new CException(Yum::t('User management module is not in Debug Mode'));
460 }
461 }
462
463 public function actionIndex()
464 {
#3
+ /opt/lampp/htdocs/yii/framework/web/actions/CInlineAction.php(50): YumInstallController->actionInstall()
#4
+ /opt/lampp/htdocs/yii/framework/web/CController.php(309): CInlineAction->runWithParams(array())
#5
+ /opt/lampp/htdocs/yii/framework/web/filters/CFilterChain.php(134): CController->runAction(CInlineAction)
#6
+ /opt/lampp/htdocs/yii/framework/web/filters/CFilter.php(41): CFilterChain->run()
#7
+ /opt/lampp/htdocs/yii/framework/web/CController.php(1146): CFilter->filter(CFilterChain)
#8
+ /opt/lampp/htdocs/yii/framework/web/filters/CInlineFilter.php(59): CController->filterAccessControl(CFilterChain)
#9
+ /opt/lampp/htdocs/yii/framework/web/filters/CFilterChain.php(131): CInlineFilter->filter(CFilterChain)
#10
+ /opt/lampp/htdocs/yii/framework/web/CController.php(292): CFilterChain->run()
#11
+ /opt/lampp/htdocs/yii/framework/web/CController.php(266): CController->runActionWithFilters(CInlineAction, array("accessControl"))
#12
+ /opt/lampp/htdocs/yii/framework/web/CWebApplication.php(276): CController->run("")
#13
+ /opt/lampp/htdocs/yii/framework/web/CWebApplication.php(135): CWebApplication->runController("user/install")
#14
+ /opt/lampp/htdocs/yii/framework/base/CApplication.php(162): CWebApplication->processRequest()
#15
– /opt/lampp/htdocs/mydemo/index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11
12 require_once($yii);
13 Yii::createWebApplication($config)->run();
2012-06-01 22:36:29 Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 Yii Framework/1.1.10
0

#2 User is offline   Dustin Oprea 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 11-February 12

Posted 01 June 2012 - 05:55 PM

Read the database error that it gives you:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'testdrive.translation' doesn't exist. The SQL statement executed was: select message, translation from translation where language = :language and category = :category

Table "testdrive.translation" doesn't exist.


Dustin Oprea
0

#3 User is offline   manis 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 30-May 12

Posted 02 June 2012 - 01:50 AM

View PostDustin Oprea, on 01 June 2012 - 05:55 PM, said:

Read the database error that it gives you:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'testdrive.translation' doesn't exist. The SQL statement executed was: select message, translation from translation where language = :language and category = :category

Table "testdrive.translation" doesn't exist.


Dustin Oprea


Thank you Dustin. I also understand that this table is not exist. During installation of User Management extension these table suppose to be created automatically. But it is not creating. I am following the exact steps given on YII framework site. So my question is do these tables will create automatically or I will have to do some extra steps for this.
0

#4 User is offline   yugene 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 500
  • Joined: 08-August 09

Posted 02 June 2012 - 11:35 PM

Hi Manis,

Did you follow /user/docs/install_tutorial.txt from downloaded extension?

And please notice there's a more proper Extensions forum for such kind of questions.
And even there's a specific thread regarding User Management module

Regards,
Yuga
0

#5 User is offline   Rupam 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 14-April 13

Posted 26 April 2013 - 02:05 AM

Hiii to all
I am newbie in Yii . actually when i try to connect my login form to data base its show
CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'final.translation' doesn't exist. The SQL statement executed was: select message, translation from translation where language = :language and category = :category

Error. plz help me to solve this problem
0

#6 User is offline   yugene 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 500
  • Joined: 08-August 09

Posted 26 April 2013 - 02:44 AM

This error means what it says - there's no `translation` table at `final` db.
Did you check this table exists?
0

#7 User is offline   Rupam 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 14-April 13

Posted 27 April 2013 - 01:01 AM

View Postyugene, on 26 April 2013 - 02:44 AM, said:

This error means what it says - there's no `translation` table at `final` db.
Did you check this table exists?

i check it properly . the table exits.
0

#8 User is offline   yugene 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 500
  • Joined: 08-August 09

Posted 27 April 2013 - 06:50 AM

What do you have in your config file regarding db connection(s)?
Do you use a property connection?
Which way you request looks like?
0

#9 User is offline   Rupam 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 14-April 13

Posted 28 April 2013 - 04:28 AM

View Postyugene, on 27 April 2013 - 06:50 AM, said:

What do you have in your config file regarding db connection(s)?
Do you use a property connection?
Which way you request looks like?

<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
'name' => 'Sarathi',

// preloading 'log' component
'preload' => array('log', 'bootstrap'),
// autoloading model and component classes
'import' => array(
'application.models.*',
'application.components.*',

'application.modules.user.models.*',
'application.modules.profile.models.*',
),

'modules' => array(
// uncomment the following to enable the Gii tool

'gii' => array(
'class' => 'system.gii.GiiModule',
'password' => 'sarathi',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters' => array('127.0.0.1', '::1'),
'generatorPaths' => array('bootstrap.gii',),
),

'user' => array(
'debug' => false,
'userTable' => 'Users',
'translationTable' => 'translation',

),

'profile' => array(

'profileTable' => 'profile',

),



),
// application components
'components' => array(
'session' => array(
'timeout' => 864000,
),
'user' => array(
'class' => 'application.modules.user.components.YumWebUser',
'allowAutoLogin' => true,
'autoRenewCookie' => true,
'authTimeout' => 31557600,
'loginUrl' => array('/'),
'returnUrl' => array('//log/pending'),
),
'cache' => array(
'class' => 'system.caching.CMemCache',
'servers' => array(
array('host' => 'localhost', 'port' => 11211, 'weight' => 50),
array('host' => 'localhost', 'port' => 11211, 'weight' => 50),
),
),
//'cache' => array('class' => 'system.caching.CFileCache'),
'import' => array(
'application.modules.user.models.*',
),

'swiftMailer' => array(
'class' => 'ext.swiftMailer.SwiftMailer',
),
// 'bootstrap'=>array(
// 'class'=>'ext.bootstrap.components.Bootstrap', // assuming you extracted bootstrap under extensions
// ),
// uncomment the following to enable URLs in path-format

'urlManager' => array(
'urlFormat' => 'path',
'rules' => array(
'referral/<email>'=>'site/refer',
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
),
// uncomment the following to use a MySQL database

'db' => array(
'connectionString' => 'mysql:host=localhost;dbname=doit',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'tablePrefix' => '',
),
'errorHandler' => array(
// use 'site/error' action to display errors
'errorAction' => 'site/error',
),
'log' => array(
'class' => 'CLogRouter',
'routes' => array(
array(
'class' => 'CFileLogRoute',
'levels' => 'error, warning',
),
// uncomment the following to show log messages on web pages
/*
array(
'class'=>'CWebLogRoute',
),
*/
),
),
),
// application-level parameters that can be accessed
// using Yii::app()->params['paramName']
'params' => array(
'version' => 5.2,
// this is used in contact page
'adminEmail' => 'rupamranjan007@gmail.com',

),
);
?>
//this is my config
0

#10 User is offline   yugene 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 500
  • Joined: 08-August 09

Posted 29 April 2013 - 12:21 AM

So, you have db configured this way (please you editor code formatting next time):


'db' => array(
	'connectionString' => 'mysql:host=localhost;dbname=doit',
	'emulatePrepare' => true,
	'username' => 'root',
	'password' => '',
	'charset' => 'utf8',
	'tablePrefix' => '',
),

Is it configured properly?
What is strange, from your request error it looks like your db should be named `final`.
If your db connection is correct, which way do you make you query?
0

#11 User is offline   Rupam 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 14-April 13

Posted 29 April 2013 - 12:42 AM

View Postyugene, on 29 April 2013 - 12:21 AM, said:

So, you have db configured this way (please you editor code formatting next time):


'db' => array(
	'connectionString' => 'mysql:host=localhost;dbname=doit',
	'emulatePrepare' => true,
	'username' => 'root',
	'password' => '',
	'charset' => 'utf8',
	'tablePrefix' => '',
),

Is it configured properly?
What is strange, from your request error it looks like your db should be named `final`.
If your db connection is correct, which way do you make you query?

i am sorry for that error. but i try to change the database table. i think i have problem in the final db table . so i create another table 'doit'.at that time i just paste this config..But after this also i got that error.
0

#12 User is offline   yugene 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 500
  • Joined: 08-August 09

Posted 29 April 2013 - 01:14 AM

You still didn't post the code for your request.
Can you run the query successfully directly in mysql?


0

#13 User is offline   Rupam 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 14-April 13

Posted 29 April 2013 - 02:34 AM

CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'doit.translation' doesn't exist. The SQL statement executed was: select message, translation from translation where language = :language and category = :category

C:\wamp\www\final\framework\db\CDbCommand.php(528)

516 return $result;
517 }
518 catch(Exception $e)
519 {
520 if($this->_connection->enableProfiling)
521 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
522 $errorInfo = $e instanceof PDOException ? $e->errorInfo : null;
523 $message = $e->getMessage();
524 Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
525 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
526 if(YII_DEBUG)
527 $message .= '. The SQL statement executed was: '.$this->getText().$par;
528 throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
529 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
530 }
531 }
532
533 /**
534 * Builds a SQL SELECT statement from the given query specification.
535 * @param array $query the query specification in name-value pairs. The following
536 * query options are supported: {@link select}, {@link distinct}, {@link from},
537 * {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
538 * {@link limit}, {@link offset} and {@link union}.
539 * @return string the SQL statement
540 * @since 1.1.6
0

#14 User is offline   yugene 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 500
  • Joined: 08-August 09

Posted 29 April 2013 - 01:44 PM

can you make the same query at mysql command line / phpmyadmin?
0

#15 User is offline   compugator 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 01-May 11

Posted 16 March 2014 - 12:15 AM

If it helps, I ran this SQL statement and it seems to have gotten me past the missing translation table.

CREATE TABLE IF NOT EXISTS translation (
            `message` varbinary(255) NOT NULL,
            `translation` varchar(255) NOT NULL,
            `language` varchar(5) NOT NULL,
            `category` varchar(255) NOT NULL,
            PRIMARY KEY (`message`,`language`,`category`)
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users