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

如何从SAP中连接其他数据库,第1张

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.

Connect to SQL Server database Prerequisite: 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 name Oracle users

DB passwordpassword for the above-mentioned Oracle user

Conn.info TNS alias

Permanent Usually should not be set for a secondary 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.

进入DBCO,设置数据库连接。点击笔按钮,可以新建一条记录也可以编辑原有的记录。

请点击输入图片描述

配置相应的连接。SAP提供多少连接选择,不同连接方式填写的内容不同。

请点击输入图片描述

SQL SERVER 数据库的连接方式,填写连接字符串,指定主机IP、用户名、密码、连接的数据库即可。

请点击输入图片描述

DB2数据库的连接,写好主机IP地址,端口号和数据库名称。

请点击输入图片描述

Oracle数据库的连接方法,必须在服务器上安装Oracle Client,设置连接信息与连接名一致。

请点击输入图片描述

MaxDB数据库的连接。MaxDB是SAP自己的数据库。连接方式如图所示。

请点击输入图片描述

如果你不是basis的话数据库是不可以改动的。

SAP中底层数据库是不允许改动的,对数据库的 *** 作都是将底层数据库中的数据取出来放在内表中,然后直接对内表进行 *** 作,内表 *** 作网上学习的例子很多的。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/8585340.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-18
下一篇 2023-04-18

发表评论

登录后才能评论

评论列表(0条)

保存