如何从SAP中连接其他数据库

本文介绍SAP R/3系统中配置不同数据库(如MSSQL和Oracle)的方法,包括工作环境需求、配置连接信息及程序中如何使用这些配置。适用于希望了解如何在SAP R/3环境中正确设置和使用外部数据库连接的技术人员。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 工作环境需求
A . The operating system user <sid>adm must be able to log on to the secondary database.
B. The R/3 table DBCON must be maintained.
C . The correct database library 'dboraslib.<ext>' must exist in the kernel directory.
Connectto SQL Server databasePrerequisite: At least one Windows application server must be available on the R/3 system and the DBSL dynamic library (DLL) dbmssslib.dll must be installed on this server. This dll can be downloaded from the SAP Service Marketplace.
dbmssslib.dll
2. 配置连接信息
配置TCODE: dbco
任何配置信息都存储在DBCON表中.
配置示例:
A. 访问MSSQL的配置示例(参见SAP Notes 178949)
CON_NAME: <my_conn_name>
DBMS: MSS
USER_NAME: <db_user>
PASSWORD:<password>
CON_ENV: MSSQL_SERVER=<server_name> MSSQL_DBNAME=<db_name>
db_user could be sapr3 for example if the server is running R/3.The password field may be blocked from view by asterisks in sm30. USER_NAME can be left blank in order to use integrated security (4.6d kernel and later).In that case make sure that the OS User running R/3 has the required privilege on the remote server.A dummy password must be entered in sm30, it will not be used when the user name is blank.
  • Specifying the server name

The server name is simply the name of the SQL Server or named instance i.e. the hostname (for a default instance), or <host>/<instname>
Starting with release 6.40 however there are some special considerations that should be taken into account.When running with kernel release 6.40 or later, the R/3 system will prepend a protocol specifier to the server name.Example:
1. For a server running on the same server:
np:<servername>
2. For a remote server:
tcp:<servername>
This forces the connection to be made with a named pipes and tcp/ip protocols respectively.
When specifying the server name you can override this by setting your own protocol (tcp: or np:), or you can make R/3 avoid setting any prefix by using simply :<servername> - a colon in front of the server name.

B. 访问ORACLE的配置示例()
Connection namelogical name of the connection
DBMS ORA
User nameOracle users
DB passwordpassword for the above-mentionedOracle user
Conn.infoTNS alias
PermanentUsually should not be set for asecondary connection.
3. 程序中如何使用

例程一
report zdbcon .
data: dbn(128).
EXEC SQL.
CONNECT TO 'DAN1'
ENDEXEC.
EXEC SQL.
SET CONNECTION 'DAN1'
ENDEXEC.
EXEC SQL.
SELECT db_name() INTO :DBN FROM SVERS
ENDEXEC.
write: / 'current database name', dbn.
DAN1在DBCON表中配置
CON NAME DAN1
DBMS MSS
USER NAME iis_log
PASSWORD CON ENV
MSSQL_SERVER=tcp:###.###.###.### MSSQL_DBNAME=iislog


例程二
Here is an example for how to connect to another server with CON_NAME=BSK.The example assumes BSK is running R/3:

EXEC SQL.
CONNECT TO 'BSK'
ENDEXEC.
EXEC SQL.
SET CONNECTION 'BSK'
ENDEXEC.
EXEC SQL.
SELECT db_name() INTO :DBN FROM SVERS
ENDEXEC.
WRITE: / 'current database name', DBN.
EXEC SQL.
SET CONNECTION DEFAULT
ENDEXEC.
EXEC SQL.
SELECT db_name() INTO :DBN FROM SVERS
ENDEXEC.
WRITE: / 'current database name', DBN.

notes: https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=178949&nlang=EN&smpsrv=https%3a%2f%2fwebsmp103%2esap-ag%2ede

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值