Sunteți pe pagina 1din 3

DB2

To use DB2 stage, we must have valid accounts and appropriate privileges on database.
Previlegas (SIT-D) are: SELECT, INSERT, TABLE CREATE, DBADM to read - SELECT to updated - INSERT to create - TABLE CREATE to replaced - INSERT and TABLE CREATE to written by LOAD method - DBADM Grant privileges: start DB2, connect to a database, and grant DBADM privilege to a user, as shown below: db2> CONNECT TO db_name db2> GRANT DBADM ON DATABASE TO USER user_name db2 connect to eis_dwh user dsadm using mumbai123 db2 "delete from SMPORTAL.EIS_IT_FACT_DIRECTOR_OUTLOOK" db2 commit db2 terminate; bash-2.04$ db2 "grant select on table PPAS_MAIN.SUBSCRIPTION_REFILL_HISTORY to user SSAV8060" DB20000I The SQL command completed successfully. bash-2.04$ DB2 environment variables set the run-time characteristics of your system: DB2INSTANCE: specifies the user name of the owner of the DB2 instance. DB2 uses DB2INSTANCE to determine the location of db2nodes.cfg. For example, if you set DB2INSTANCE to "Mary", the location of db2nodes.cfg is ~Mary/sqllib/db2nodes.cfg. DB2DBDFT: specifies the name of the DB2 database that you want to access from your DB2 stage. There are two other methods of specifying the DB2 database: override database property of the DB2 stage Inputs or Outputs link. APT_DBNAME environment variable (this takes precedence over DB2DBDFT). APT_RDBMS_COMMIT_ROWS environment variable specifies the number of records to insert into a data set between commits. We can set between 1 and (231 - 1). The default value is 2048. You may find that you can increase your system performance by decreasing the frequency of these commits using the environment variable APT_RDBMS_COMMIT_ROWS. If we set APT_RDBMS_COMMIT_ROWS to 0, a negative number, or an invalid value, a warning is issued and each partition commits only once after the last insertion.

If we set a small value for APT_RDBMS_COMMIT_ROWS, to perform frequent commits. Therefore, if program terminates unexpectedly, your data set can still contain partial results that you can use. However, you may pay a performance penalty because of the high frequency of the commits. If we set a large value for APT_RDBMS_COMMIT_ROWS, DB2 must log a correspondingly large amount of rollback information. This, too, may slow your application. Handling Special Characters ($ and #) # and $ characters are reserved in DataStage and special steps are needed to handle DB2 databases which use the characters # and $ in column names. DataStage converts these characters into an internal format, and then converts them back as necessary. To take advantage of this facility, you need to do the following: In DataStage Administrator, open the Environment Variables dialog for the project in question, and set the environment variable DS_ENABLE_RESERVED_CHAR_CONVERT to true (this can be found in the General\Customize branch). Avoid using the strings __035__ and __036__ in your DB2 column names (these are used as the internal representations of # and $ respectively). DB2/UDB Enterprise Stage
Input Page Properties Tab

Target Category Table Specify name of the table to write to Write Method Delete Rows, Write, Upsert, or Load (the default) Write Mode (available in Load and Write method) Append (the default) - New records are appended Create - Create a new table, if exists an error occurs Replace - Existing table is first dropped then create new table in its place NOTE: Cannot create or replace a table that has primary keys. Truncate - Existing table is first dropped except schema and DB2 partitioning keys then create new table in its place Delete Rows Mode Auto-generated Delete User-defined Delete Delete SQL Upsert Mode Auto-generated Update & Insert Auto-generated Update Only User-defined Update & Insert User-defined Update Only Insert SQL Update SQL

Connection Category Use Server Environment Variable (true) This is set to True by default, which causes the stage to use the setting of the DB2INSTANCE environment variable to derive the server. If you set this to False, you must specify a value for the Override Server property. Use Database Environment Variable (true) This is set to True by default, which causes the stage to use the setting of the environment variable APT_DBNAME, if defined, and DB2DBDFT otherwise to derive the database. If you set this to False, you must specify a value for the Override Database property. Server specifies the DB2 instance name for the table. This property appears if you set Use Server Environment Variable property to False. Database specifies the name of the DB2 database to access. This property appears if you set Use Database Environment Variable property to False. Options Category

Output Page Properties Tab

Source Category Lookup Type Normal, Sparse Read Method table, auto-generated query, user-defined query Query Table Where clause Select List Connection Category Use Server Environment Variable (true) Use Database Environment Variable (true) Override Server Override Database Options Category Close Command Open Command Pad Character

S-ar putea să vă placă și