CDbCommand failed to execute the SQL statement: SQLSTATE[42S22] - yii

I'm working with yii users and rights and following this link, http://www.yiiframework.com/wiki/423/installing-yii-users-and-rights-to-newly-created-yii-app/
I have applied all the things mentioned in this link, but when i type the url localhost/webapp/user/login it asks me to login. Upon login i get this error :
CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]:
Column not found: 1054 Unknown column 'id' in 'field list'. The SQL
statement executed was: SELECT id, username, email, createtime,
lastvisit, superuser, status, password, activkey FROM user t WHERE
t.username=:yp0 LIMIT 1
Please help me with this..!!

make sure you have a column "id" in the user table. In Yii, id is the default primary key as well

Related

ORA-00903: invalid table name when selecting from USER

I have a task of connecting to a legacy Oracle 9i database and validate users with the new ERP, however when I try to run the query, I get ORA-00903: invalid table name
This is the naive query I am starting with: SELECT * FROM USER. The table does exist, and I can view it's content using an "in-house database browser" made by some company that no longer exist and to which I do not have the source code for.
Obviously, SELECT * FROM ALL_USERS is not what I want, etc.
The point is to validate that some user credentials are valid, the most fundamental concept of authentication, against a table called "USER", with two fields: USER_NO and PASSWORD (all values stored in plain text (... yeah... I know).
user is a reserved keyword. If you want to use that for a table name you have to quote it (which you already had to do when creating it)
select *
from "USER";

ORA-00904: "DBMS_METADATA"."GET_DDL": invalid identifier

I get the ORA-00904: "DBMS_METADATA"."GET_DDL": invalid identifier error when I run dbms_metadata.
That error is for having the wrong column name or alias. I am not sure why I am getting it.
Here is some code to show the error: I create a table:
create table test_table (
column1 varchar2(300));
I insert a row of data:
insert into test_table values (55);
I try to get the DDL for it:
SELECT DBMS_METADATA.GET_DDL('TABLE','test_table') FROM dual;
Here is the error:
>> SELECT DBMS_METADATA.GET_DDL('TABLE','test_table') FROM dual
*
Error at line 1
ORA-00904: "DBMS_METADATA"."GET_DDL": invalid identifier
I checked permissions and it appears I have the correct permissions:
select * FROM DBA_ROLE_PRIVS where granted_role = 'SELECT_CATALOG_ROLE';
My user (aka schema) is in that list.
Here are, what I believe, the docs: https://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_metada.htm#i1016867
Run this command as SYS:
grant execute on sys.dbms_metadata to public;
Granting access to your specific user may have solved your current problem, but that package really needs to be available to the entire system. Many third party programs depend on DBMS_METADATA. By default that package should be granted to PUBLIC.
Some old versions of the STIG (Secure Technical Implementation Guidelines, which almost every auditor uses as the basis for their security scripts), would revoke access from public packages. But that was a stupid idea even 10 years ago, and it's not in the current STIGs anymore anyway.

ORA-12154: TNS:could not resolve the connect identifier specified - Connecting to a remote database

I have two databases, CitadelStation and SQL_Course.
There is a table in the SQL_Course database called, TEST under the user, "course" whose password is, "course."
When I try to create a database link to this table from CitadelStation, I run into trouble. The command I used to create this database link is:
create database link remote_connection
connect to course identified by course
using 'SQL_Course';
The link is successfully created, but when I try to query the TEST table, I receive the following error:
select * from test#remote_connection;
select * from test#remote_connection
*
ERROR at line 1:
ORA-12154: TNS:could not resolve the connect identifier specified
What can I do to resolve this issue?

SQL Developer create a new user

I am a new user in SQL Developer Oracle 12c database and when I try to create a new user:
CREATE USER usera IDENTIFIED BY mypsassword
I get this error:
error starting at line 2 in command:
CREATE USER usera IDENTIFIED BY mypsassword
Error at Command Line:2 Column:13
Error report:
SQL Error: ORA-65096: invalid common user or role name
What can I do?
Thanks for your help guys
Without specific knowledge of Oracle it seems to me that Oracle is nudging you to use less generic usernames. Try replacing usera with something else for example pluto.

access error sql server 2008

I have created a user but when I try to view a database tables, I'm having the following error messages:
Please note that I am able to login but not having access to the database.
Failed to retrieve data for this request.
(Microsoft.SqlServer.Management.Sdk.Sfc)
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or
batch. (Microsoft.SqlServer.ConnectionInfo)
The SELECT permission was denied on the object 'extended_properties',
database 'mssqlsystemresource', schema
'sys'. (Microsoft SQL Server, Error: 229)
Did you map the login to the user?
EXEC SP_Change_Users_Login 'Update_One','user','login',Null
In the Secutity -> Logins -> userName, check the database is selected in the list or not.
In the Database -> Security -> UserName check the role member has sufficient priviliges.
Check out this one
Another marked an answer
More Links