Hi,
i must connect this RESTFULL api with database Oracle 10G:
and change ‘db’ in:
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'oci:dbname=//localhost:1521/orclftp',
'username' => 'FTPDB',
'password' => 'FTPDB',
'charset' => 'utf8'
],
but when i call my first url:
http://localhost/yii2api_SQL/backend/web/1/authorize
i have this error:
{
“name”: “Database Exception”,
“message”: “SQLSTATE[HY000]: General error: 904 OCIStmtExecute: ORA-00904: “status”: invalid identifier\n (ext\pdo_oci\oci_statement.c:157)\nThe SQL being executed was: SELECT * FROM “USERORA” WHERE (“id”=34) AND (“status”=10)”,
“code”: 0,
“type”: “yii\db\Exception”,
“file”: “C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\db\Schema.php”,
“line”: 595,
“stack-trace”: ["#0 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\db\Command.php(1053): yii\db\Schema->convertException(Object(PDOException), ‘SELECT * FROM "…’)", “#1 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\db\Command.php(376): yii\db\Command->queryInternal(‘fetch’, NULL)”, “#2 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\db\Query.php(257): yii\db\Command->queryOne()”, “#3 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\db\ActiveQuery.php(294): yii\db\Query->one(NULL)”, “#4 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\db\BaseActiveRecord.php(107): yii\db\ActiveQuery->one()”, “#5 C:\wamp64\www\yii2api_SQL\common\models\User.php(68): yii\db\BaseActiveRecord::findOne(Array)”, “#6 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\web\User.php(657): common\models\User::findIdentity(34)”, “#7 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\web\User.php(188): yii\web\User->renewAuthStatus()”, “#8 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\web\User.php(333): yii\web\User->getIdentity()”, “#9 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\Component.php(133): yii\web\User->getIsGuest()”, “#10 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2-debug\panels\UserPanel.php(75): yii\base\Component->__get(‘isGuest’)”, “#11 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\BaseObject.php(108): yii\debug\panels\UserPanel->init()”, “#12 [internal function]: yii\base\BaseObject->__construct(Array)”, “#13 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\di\Container.php(382): ReflectionClass->newInstanceArgs(Array)”, “#14 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\di\Container.php(156): yii\di\Container->build(‘yii\\debug\\panel…’, Array, Array)”, “#15 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\BaseYii.php(349): yii\di\Container->get(‘yii\\debug\\panel…’, Array, Array)”, “#16 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2-debug\Module.php(178): yii\BaseYii::createObject(Array)”, “#17 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2-debug\Module.php(151): yii\debug\Module->initPanels()”, “#18 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\BaseObject.php(108): yii\debug\Module->init()”, “#19 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\Module.php(158): yii\base\BaseObject->__construct(Array)”, “#20 [internal function]: yii\base\Module->__construct(‘debug’, Object(yii\web\Application), Array)”, “#21 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\di\Container.php(376): ReflectionClass->newInstanceArgs(Array)”, “#22 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\di\Container.php(156): yii\di\Container->build(‘yii\\debug\\Modul…’, Array, Array)”, “#23 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\BaseYii.php(349): yii\di\Container->get(‘yii\\debug\\Modul…’, Array, Array)”, “#24 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\Module.php(427): yii\BaseYii::createObject(Array, Array)”, “#25 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\Application.php(315): yii\base\Module->getModule(‘debug’)”, “#26 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\web\Application.php(69): yii\base\Application->bootstrap()”, “#27 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\Application.php(273): yii\web\Application->bootstrap()”, “#28 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\BaseObject.php(108): yii\base\Application->init()”, “#29 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\Application.php(206): yii\base\BaseObject->__construct(Array)”, “#30 C:\wamp64\www\yii2api_SQL\backend\web\index.php(17): yii\base\Application->__construct(Array)”, “#31 {main}”],
“error-info”: [“HY000”, 904, “OCIStmtExecute: ORA-00904: “status”: invalid identifier\n (ext\pdo_oci\oci_statement.c:157)”],
“previous”: {
“name”: “Exception”,
“message”: “SQLSTATE[HY000]: General error: 904 OCIStmtExecute: ORA-00904: “status”: invalid identifier\n (ext\pdo_oci\oci_statement.c:157)”,
“code”: “HY000”,
“type”: “PDOException”,
“file”: “C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\db\Command.php”,
“line”: 1038,
“stack-trace”: ["#0 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\db\Command.php(1038): PDOStatement->execute()", “#1 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\db\Command.php(376): yii\db\Command->queryInternal(‘fetch’, NULL)”, “#2 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\db\Query.php(257): yii\db\Command->queryOne()”, “#3 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\db\ActiveQuery.php(294): yii\db\Query->one(NULL)”, “#4 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\db\BaseActiveRecord.php(107): yii\db\ActiveQuery->one()”, “#5 C:\wamp64\www\yii2api_SQL\common\models\User.php(68): yii\db\BaseActiveRecord::findOne(Array)”, “#6 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\web\User.php(657): common\models\User::findIdentity(34)”, “#7 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\web\User.php(188): yii\web\User->renewAuthStatus()”, “#8 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\web\User.php(333): yii\web\User->getIdentity()”, “#9 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\Component.php(133): yii\web\User->getIsGuest()”, “#10 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2-debug\panels\UserPanel.php(75): yii\base\Component->__get(‘isGuest’)”, “#11 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\BaseObject.php(108): yii\debug\panels\UserPanel->init()”, “#12 [internal function]: yii\base\BaseObject->__construct(Array)”, “#13 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\di\Container.php(382): ReflectionClass->newInstanceArgs(Array)”, “#14 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\di\Container.php(156): yii\di\Container->build(‘yii\\debug\\panel…’, Array, Array)”, “#15 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\BaseYii.php(349): yii\di\Container->get(‘yii\\debug\\panel…’, Array, Array)”, “#16 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2-debug\Module.php(178): yii\BaseYii::createObject(Array)”, “#17 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2-debug\Module.php(151): yii\debug\Module->initPanels()”, “#18 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\BaseObject.php(108): yii\debug\Module->init()”, “#19 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\Module.php(158): yii\base\BaseObject->__construct(Array)”, “#20 [internal function]: yii\base\Module->__construct(‘debug’, Object(yii\web\Application), Array)”, “#21 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\di\Container.php(376): ReflectionClass->newInstanceArgs(Array)”, “#22 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\di\Container.php(156): yii\di\Container->build(‘yii\\debug\\Modul…’, Array, Array)”, “#23 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\BaseYii.php(349): yii\di\Container->get(‘yii\\debug\\Modul…’, Array, Array)”, “#24 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\Module.php(427): yii\BaseYii::createObject(Array, Array)”, “#25 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\Application.php(315): yii\base\Module->getModule(‘debug’)”, “#26 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\web\Application.php(69): yii\base\Application->bootstrap()”, “#27 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\Application.php(273): yii\web\Application->bootstrap()”, “#28 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\BaseObject.php(108): yii\base\Application->init()”, “#29 C:\wamp64\www\yii2api_SQL\vendor\yiisoft\yii2\base\Application.php(206): yii\base\BaseObject->__construct(Array)”, “#30 C:\wamp64\www\yii2api_SQL\backend\web\index.php(17): yii\base\Application->__construct(Array)”, “#31 {main}”]
}
}
the table user in Oracle is: USERORA ( user is default of Oracle and can’t rename )
i changed on models/user.php
public static function tableName()
{
return ‘{{%USERORA}}’;
}
thanks