473,388 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Do you have to always specify schema when using db2 CLP?

We have 5 users of our database (DB2 UDB 8.1 on SuSE linux) :

db2inst1
bill
fred
sarah
jessica

The tables are created under db2inst1, which has the ability to
drop/create/alter/etc. bill, fred, sarah and jessica all have select
privileges on some of these tables.

If I go into the CLP and connect as db2inst1, I can write
SELECT * FROM authors
and get results back. If I connect as bill, then
SELECT * FROM authors
gives SQL0204N "BILL.AUTHORS" is an undefined name.
whereas
SELECT * from db2inst1.authors
executes correctly. To save my users having to refer to the schema
every time they mention a table name, is there a way to set the schema
in the CLP session to default to db2inst1 rather than
bill/fred/sarah/jessica?
Nov 12 '05 #1
7 7331
First issue: set current schema = 'DB2INST1'

James Foreman wrote:
We have 5 users of our database (DB2 UDB 8.1 on SuSE linux) :

db2inst1
bill
fred
sarah
jessica

The tables are created under db2inst1, which has the ability to
drop/create/alter/etc. bill, fred, sarah and jessica all have select
privileges on some of these tables.

If I go into the CLP and connect as db2inst1, I can write
SELECT * FROM authors
and get results back. If I connect as bill, then
SELECT * FROM authors
gives SQL0204N "BILL.AUTHORS" is an undefined name.
whereas
SELECT * from db2inst1.authors
executes correctly. To save my users having to refer to the schema
every time they mention a table name, is there a way to set the schema
in the CLP session to default to db2inst1 rather than
bill/fred/sarah/jessica?


--
Anton Versteeg
IBM Certified DB2 Specialist
IBM Netherlands
Nov 12 '05 #2
Anton Versteeg <an************@nnll.iibbmm.com> wrote in message news:<40**************@nnll.iibbmm.com>...
First issue: set current schema = 'DB2INST1'


I suggest that, too. However, at a later point, if you decide to allow
your users creation of their own tables, they'll face the same
problem. So if your set of db2inst-tables remains mostly static, I
suggest you add views of your tables into each user's respective
schema (and leave the 'current schema' setting untouched).

hth
Nov 12 '05 #3
Thanks. We've granted SELECT privileges to bill on all tables in the
db2inst1 schema. But if I connect as bill, set schema to db2inst1 and
then try LIST TABLES I get no results returned. Do I need to
configure privileges elsewhere (eg at schema level?)

Anton Versteeg <an************@nnll.iibbmm.com> wrote in message news:<40**************@nnll.iibbmm.com>...
First issue: set current schema = 'DB2INST1'

Nov 12 '05 #4
It would be easier to create aliases then views.
So let all users do for all tables and or views:

CREATE ALIAS x FOR DB2INST1.x
etc.

Almund Sebi wrote:
Anton Versteeg <an************@nnll.iibbmm.com> wrote in message news:<40**************@nnll.iibbmm.com>...

First issue: set current schema = 'DB2INST1'


I suggest that, too. However, at a later point, if you decide to allow
your users creation of their own tables, they'll face the same
problem. So if your set of db2inst-tables remains mostly static, I
suggest you add views of your tables into each user's respective
schema (and leave the 'current schema' setting untouched).

hth


--
Anton Versteeg
IBM Certified DB2 Specialist
IBM Netherlands
Nov 12 '05 #5
Try "list tables for schema db2inst1"

James Foreman wrote:
Thanks. We've granted SELECT privileges to bill on all tables in the
db2inst1 schema. But if I connect as bill, set schema to db2inst1 and
then try LIST TABLES I get no results returned. Do I need to
configure privileges elsewhere (eg at schema level?)

Anton Versteeg <an************@nnll.iibbmm.com> wrote in message news:<40**************@nnll.iibbmm.com>...

First issue: set current schema = 'DB2INST1'


--
Anton Versteeg
IBM Certified DB2 Specialist
IBM Netherlands
Nov 12 '05 #6
Thanks. All working nicely
Nov 12 '05 #7
As an alternative to this, any user has the privilege to define an alias for
any of the table one has access to.
db2 connect to <dbname> user bill using somepw
db2 select * from db2inst1.authors ==> This works
db2 create alias bill.myauthors for db2inst1.authors
db2 select * from myauthors ==> This will also work

The alias is: bill.myauthors and is valis as long as no other object in the
db is called bill.myauthors. (Note that the alias could also be
bill.authors as no other object is called bill.authors).
Your users then do not have to remember to set the current schema.
HTH, Pierre.
"Anton Versteeg" <an************@nnll.iibbmm.com> a écrit dans le message de
news:40**************@nnll.iibbmm.com...
First issue: set current schema = 'DB2INST1'

James Foreman wrote:
We have 5 users of our database (DB2 UDB 8.1 on SuSE linux) :

db2inst1
bill
fred
sarah
jessica

The tables are created under db2inst1, which has the ability to
drop/create/alter/etc. bill, fred, sarah and jessica all have select
privileges on some of these tables.

If I go into the CLP and connect as db2inst1, I can write
SELECT * FROM authors
and get results back. If I connect as bill, then
SELECT * FROM authors
gives SQL0204N "BILL.AUTHORS" is an undefined name.
whereas
SELECT * from db2inst1.authors
executes correctly. To save my users having to refer to the schema
every time they mention a table name, is there a way to set the schema
in the CLP session to default to db2inst1 rather than
bill/fred/sarah/jessica?


--
Anton Versteeg
IBM Certified DB2 Specialist
IBM Netherlands


Nov 12 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Till Soerensen | last post by:
I would like to validate a xml file against a xsd file on my hard disc. Ok, I could specify the location of the XSD Schema in the instance of the xml file as follows: <Person...
0
by: Jeff | last post by:
This is one that has been stumping me for a few days now. I have an xml document that is based on a schema, and that schema is based on another schema. When using XMLSpy 2004 Enterprise Edition,...
6
by: LesleyW | last post by:
Hi Apologies if this is a really dumb question, but being new to XML and Schemas, I wonder if giving the namespace for eg xsd or xsi as a website address means that the user has to be online...
4
by: Raposa Velha | last post by:
So, chosen the interface for my app, finally I got stuck with transactions. Boy!, how many ways of doing the same job are there?! Any suggestion so I could find myself in the right direction?...
2
by: Ali | last post by:
I am having problem compiling schema contained in WSDL file when analyzing schema types contained in it (for example http://www.ebout.net/net/GoogleSearch.wsdl). Following code demonstrates my...
5
by: Jeff | last post by:
We are using .Net and the wsdl Utility to generate proxies to consume web services built using the BEA toolset. The data architects on the BEA side create XML schemas with various entities in...
0
by: billmiami2 | last post by:
I'm creating an ASP.NET web service with a number of web methods. The consumers of these web services are developers using Macromedia Flash which comes with its own interface for web services. In...
5
by: CindyRob | last post by:
Using .NET framework 1.1 SP1, .NET framework SDK 1.1 SP1, Visual Studio .NET 2003, hotfixes 892202 and 823639. I create a proxy class using wsdl.exe, and in the serialized XML request, I see...
2
by: smachin1000 | last post by:
Hi All, In the sample schema & document below, I'd like the attribute "name" to be unique for all function elements under function_list. The tools I'm using (XML Spy and xmllint) all validate...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.