If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Sequence Synonym or Nickname

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-20-04, 11:40
BrianFineos BrianFineos is offline
Registered User
 
Join Date: Jan 2004
Posts: 18
Unhappy Sequence Synonym or Nickname

Hi

Is it possible to create a SYNONYM for a SEQUENCE in DB2?

I am using UDB 8.1.5 on both NT and Solaris. I am quite new to DB2 (I'm an Oracle head! Sorry!).

I have been able to create:
- Grants for Sequences
- Grants for Tables
- Grants for Views
- Synonyms for Tables
- Synonyms for Views

e.g. CREATE SYNONYM FOAPPUSER.TLOCK FOR FOAPP.TLOCK
... where FOAPP owns Table TLOCK, and FOAPPUSER wants to refer to this Table without prefixing the Table Owner.

This works fine for Tables and Views, but not for SEQUENCES.

This is a serious spanner in the works for me!!

Any ideas / workarounds? Creating the Sequences in FOAPPUSER is currently not an option.

Many many thanks in advance.

Brian.
Reply With Quote
  #2 (permalink)  
Old 07-20-04, 12:42
Damian Ibbotson Damian Ibbotson is offline
Padawan
 
Join Date: Jun 2002
Location: UK
Posts: 525
What exactly is the 'spanner in the works'?

You could probably get round it by wrapping the call to your sequence in a stored procedure.
Reply With Quote
  #3 (permalink)  
Old 07-20-04, 12:58
BrianFineos BrianFineos is offline
Registered User
 
Join Date: Jan 2004
Posts: 18
We have a mature product that has traditionally been sold on SQL Server and Oracle, where such concepts as creating synonyms for sequences was a valid concept.

We have now ported it to DB2, and all works fine when the Application and Serucity Schemas that are the objects owners are also the Schemas that connect from the Application. However, we need to add an extra layer of security, namely dummy schemas that do not own any objects, but merely have S/I/U/D grants and synonyms to the object owner schemas.

This system has approx 300 sequences and the code is set in stone.
How do you suggest a stored procedure would help?
e.g. INSERT INTO TLOCK (C,I,blah,blah2) VALUES(106,SLock.Nextval,'blah','blah2');
would be an example of some of our code....

Changing the code is NOT an option.

Cheers,

Brian.
Reply With Quote
  #4 (permalink)  
Old 07-21-04, 09:24
BrianFineos BrianFineos is offline
Registered User
 
Join Date: Jan 2004
Posts: 18
Any takers?
Any ideas?
Reply With Quote
  #5 (permalink)  
Old 07-21-04, 09:30
Damian Ibbotson Damian Ibbotson is offline
Padawan
 
Join Date: Jun 2002
Location: UK
Posts: 525
If you've just ported this, how come changing the code is not an option? The migration must have involved some changes?

The idea of using an SP would be to create procedure referencing whichever objects you require. the SP would bind to those objects (i.e. your sequence) and you could grant execute on the SP's package to a user that otherwise wouldn't have access to those objects.

Maybe this won't fit your scenario but it is a workaround for this kind of problem.

Damian
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On