473,494 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 7337
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
24919
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
1095
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
4416
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
2210
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
7278
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
5372
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
1181
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
4891
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
1864
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
7157
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
7195
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...
0
7367
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1400
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
644
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
285
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.