Question

i googled it and find nothing. Short story, i created a user and granted to a table in my SyBase. but when i try

select * from table1

it didn't work. Error show Permission denied: you don't have permission to select from "table1" and i try add dbname before table name like this and it works :

select * from dbname.table1

i suspect that user default database is something else so i want to set dbname to his default database. Anyone know how to do this?

Was it helpful?

Solution

This has nothing to do with database names (or login policies). Given your comment that "dbname" is actually the user who owns the table, here's what's happening.

When you specify a table name without an owner, the server has to figure out which table you mean. It first looks for a table that you own with that name. If it doesn't find one, it looks for tables owned by any groups that you are a member of. I suspect that one of these groups has a table named "table1" that you do not have permission to select from.

When you specify a table name with an owner, the server knows exactly which table to use. Since you do have permission to select from that table, you get the results you want.

OTHER TIPS

IQ doesn't have default databases/schemas. Instead it uses login policies. Each database has a login policy assigned to it, which can be altered. You can also create custom login policies.

When you create a user account with out specifying a login policy, it automatically gets the root login policy.

For more information, check the following SAP Sybase IQ docs:

Intro to IQ: Managing Users and Groups

System Admin Guide V1: Managing User IDs and Permissions

Using a view or procedure is a useful method. That said, to establish a "default" schema in (IQ 15.x) one would use groups. Essentially, one grants group to the schema owner and makes the individual login accounts (or other groups) members of that group. Note that this only gives the user access to the schema--that is, it eliminates the need to preface the object with the schema/owner name (unless there are object name conflicts only resolvable with explicit schema.object naming). This does not include a grant of permissions. None of the implicit table-owner related privileges will inherit. However, as the schema/owner is now also a group, permissions could be granted at that level.

See: http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc00170.1540/doc/html/san1288042708174.html (Managing User ID's and permissions). Be warned: this material generally requires some close reading and experimentation before it becomes useful.

As I understand it, this method is complementary to (functionally replaced by) the new role-based model in IQ 16. However, as I am still feeling my through IQ 16, there is probably a great deal more to be said, and I am not ready to comment just yet.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top