使用python PyHDB连接到SAP HANA时如何找到主机/端口 [英] How do I found out the Host/Port when connecting to SAP HANA using python PyHDB

查看:70
本文介绍了使用python PyHDB连接到SAP HANA时如何找到主机/端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试连接到SAP HANA数据库,但是我不知道在哪里可以找到 pyhdb.connect的 host port 属性.()

下面的测试代码

 导入pyhdb连接= pyhdb.connect(host =",port =",user ="exampleusername",密码="examplepassword")游标= connection.cursor()cursor.execute("SELECT'Hello Python World'")cursor.fetchone()connection.close() 

有人可以指出我正确的方向吗?

解决方案

HOST PORT DATABASENAME 是SAP HANA登录的一部分信息,形成数据库的逻辑地址.

如果您不控制数据库,则没有办法找出"那些参数的值.除了有人告诉您之外,其他人都会告诉您.

在这种情况下, HOST 是运行HANA数据库的系统的网络主机地址. PORT 取决于数据库系统的实际安装,而 DATABASENAME 是数据库的逻辑名称,同样,数据库管理员可以自由选择.

以SAP HANA Express Edition虚拟机为例: HOST 将是 hxehost (或VM可访问的IP地址).
PORT 39015 ,遵循 3xx15 模式,其中 xx 是该对象的实例编号系统,在这种情况下为 90 .
DATABASENAME 最后是 HXE ( H ANA E x E 版本).

I'm trying to connect to a SAP HANA database, but I don't know where to find the host or port attributes for pyhdb.connect()

Test Code Below

import pyhdb

connection = pyhdb.connect(
    host="",
    port="",
    user="exampleusername",
    password="examplepassword"
)

cursor = connection.cursor()
cursor.execute("SELECT 'Hello Python World'")
cursor.fetchone()

connection.close()

Can someone please point me in the right direction?

解决方案

HOST,PORT and DATABASENAME are part of the SAP HANA logon information, forming the logical address of the database.

There is no way to "find out" the values for those parameters if you don't control the database except for that somebody who does, tells you.

The HOST in this scenario is the network host address for the system where the HANA database runs on. PORT depends on the actual installation of the database system and DATABASENAME is the logical name of the database, again something that can be freely chosen by the database administrator.

Using the SAP HANA Express Edition Virtual Machine as an example: HOST would be hxehost (or the IP address that the VM is reachable at).
PORT is 39015 following the 3xx15 pattern where xx is the instance number of the system, 90 in this instance.
DATABASENAME finally is HXE (HANA Express Edition).

这篇关于使用python PyHDB连接到SAP HANA时如何找到主机/端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆