When you want to set up external database connection, you need to use DBCO or DBACOCKPIT Transaction.
When using these transactions, you are setting up the properties for an external database.
Note: Insert the same TNSNames Alias into
file TNSNames.ora under Sap Profile Directory
(C:\usr\sap\<SID>\SYS\profile\oracle\ tnsnames.ora )
http://i669.photobucket.com/albums/vv53/simon_djflex/WORK/DBACOCKPIT_DBConnections.jpg
You need to set the following parameters:
DB Connection: Logical name
DBMS: type of database (e.g. oracle, mssql, etc)
User name: user name that connect to the database
DB Password: password
Conn. Info: same target name as in tnsnames
http://i669.photobucket.com/albums/vv53/simon_djflex/WORK/DBACOCKPIT_DBConnections_Settings.jpg
With Test Connection Button you can test if your connection work fine.
http://i669.photobucket.com/albums/vv53/simon_djflex/WORK/DBACOCKPIT_TestSuccessfully.jpg
When using these transactions, you are setting up the properties for an external database.
BASIS STEPS
Insert TNSNames Alias into file TNSNames.ora under Oracle Directory (C:\oracle\<SID>\102\network\admin\ tnsnames.ora)YYY.WORLD = (DESCRIPTION = (ADDRESS = (COMMUNITY = TCP.WORLD) (PROTOCOL = TCP) (HOST = host.xxxxxxx) (PORT = 1521) ) (CONNECT_DATA = (SID = YYY) (GLOBAL_NAME = YYY.WORLD) ) )
ADMINISTRATION STEPS
DBACOCKPIT Transaction -> DB Connections Tab -> Addhttp://i669.photobucket.com/albums/vv53/simon_djflex/WORK/DBACOCKPIT_DBConnections.jpg
You need to set the following parameters:
DB Connection: Logical name
DBMS: type of database (e.g. oracle, mssql, etc)
User name: user name that connect to the database
DB Password: password
Conn. Info: same target name as in tnsnames
http://i669.photobucket.com/albums/vv53/simon_djflex/WORK/DBACOCKPIT_DBConnections_Settings.jpg
With Test Connection Button you can test if your connection work fine.
http://i669.photobucket.com/albums/vv53/simon_djflex/WORK/DBACOCKPIT_TestSuccessfully.jpg
SAMPLE CODE FOR CONNECTION TO EXTERNAL DB
DATA: lv_dbs_connection TYPE dbcon-con_name VALUE 'BDXXX', lv_current_connection TYPE dbcon-con_name. DATA dbtype TYPE dbcon_dbms. SELECT SINGLE dbms FROM dbcon INTO dbtype WHERE con_name = lv_dbs_connection. IF dbtype = 'ORA'. TRY. EXEC SQL. CONNECT TO :lv_dbs_connection ENDEXEC. IF sy-subrc <> 0. RAISE EXCEPTION TYPE cx_sy_native_sql_error. ENDIF. EXEC SQL. SET CONNECTION :lv_dbs_connection ENDEXEC. EXEC SQL. DISCONNECT :lv_current_connection ENDEXEC. ENDTRY. ENDIF.
먼저 /sapmnt/***/profile/oracle/tnsnames.ora를 등록한다.
댓글 없음:
댓글 쓰기