Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2004
    Posts
    13

    Unanswered: Do we have Synonyms in DB2

    Hi all,

    Do we have a mechanism to implement synonyms (like Oracle synonyms) in DB2.

    thanks in advance,
    Lahiru

  2. #2
    Join Date
    Feb 2002
    Posts
    96
    What is your OS??

    For z/os, you can use SYNONYM.
    For others, you can use ALIAS.

    Take a look at SQL reference for syntax.(CREATE ALIAS ...)

    Regards
    Prakash

  3. #3
    Join Date
    Apr 2004
    Posts
    13
    Thanx. I already looked into that but it does not serv my purpose. I actually need to access tables without prifixing the schema name for different users.

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Two options :
    1) Issue the SET SCHEMA in your program
    2) Create an ALIAS for each user

    The second one is a bit messy if the number of aliases increases (probably, true for ORACLE SYNONYMNs also)

    Cheers
    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  5. #5
    Join Date
    Apr 2004
    Posts
    13

    Exclamation

    the first solution is out any way. But the second one could u set the alias to users. To my knowledge it only gives another name to the table. For example After adding a alias I still had to access the table with <schemaname>.<aliasname>.

    Cheers Lahiru

  6. #6
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    CREATE TABLE USER1.TABLE1 ...

    connect as USER2 :
    SELECT * from TABLE1
    Error: Table cannot be found .

    As a privileged user :
    CREATE ALIAS USER2.TABLE1 for USER1.TABLE1

    Connect as USER2:
    SELECT * from TABLE1
    (Selects Rows)

    Isn't this you want ?


    Cheers
    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  7. #7
    Join Date
    Apr 2004
    Posts
    13

    Thumbs up

    Ah yes that what I want. Fine I was using the db2 client on Windows it didn't diaplay me the user i wanted. When I ran the the DDL as script with the user I want it fine now. Thanx....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •