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 > SET SCHEMA permanently

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-24-11, 12:39
merik merik is offline
Registered User
 
Join Date: Apr 2011
Posts: 32
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.
Reply With Quote
  #2 (permalink)  
Old 08-24-11, 12:48
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
Reply With Quote
  #3 (permalink)  
Old 08-25-11, 01:38
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
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.
Reply With Quote
  #4 (permalink)  
Old 08-25-11, 03:54
Mathew_paul Mathew_paul is offline
Registered User
 
Join Date: Oct 2007
Posts: 200
or create a user BLAH on OS and loggin from tht to db.

regds
Paul
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