Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2011
    Posts
    38

    Unanswered: SET SCHEMA permanently

    How can I change the default schema for my user account on a DB2 database? Currently, my default schema is my user schema, and I have to run "set schema 'BLAH'" every time I log in to the server. I want 'BLAH' to be my default schema.

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    If you have DB2 LUW 9.7, you can create a stored procedure that checks the current user and if it is the one for your account, then you can execute the set schema command. The stored procedure will be executed every time anyone logs on to the database if the SP is specified in this db cfg parm:

    Connect procedure (CONNECT_PROC) = XXX.XXXXXXXXX
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    You can configure it in the db2-client you are using (i.e. db2cli.cfg: DB2 Database for Linux, UNIX, and Windows )
    or as a parameter in the java/jdbc connect or in the perl/DBI connect.
    You never have to code it in your application.

  4. #4
    Join Date
    Oct 2007
    Posts
    246
    or create a user BLAH on OS and loggin from tht to db.

    regds
    Paul

Posting Permissions

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