当我尝试创建数据存储区时,在地理服务器中输入错误的端口(30015)编号,数据库SAP HANA CLOUD

问题描述 投票:1回答:3

当我尝试创建数据存储区时,地理服务器采用了错误的端口号,因为我无法创建存储。数据库是sap Hana cloud。

来自SAP Hana云我正在推出地理服务器2.14。在geoserver war中,我添加了gt-jdbc-hana-21.0.jar(由geotool提供)和** ngdbc.jar **。

从云端,我启动了地理服务器,然后创建了工作区。然后我尝试创建数据存储区。我填写了所有需要的字段。但是端口号我给30047(我的hana云端口号),但它正在尝试连接端口号30015,而不是那里。因此,我无法创建数据存储,请任何人帮助解决问题以及如何解决问题。

我收到的错误消息

Error creating data store, check the parameters. 
Error message: Unable to obtain connection: 
Cannot create PoolableConnectionFactory (SAP DBTech JDBC: Cannot connect to jdbc:sap://vadbi1l.nwtrial.od.sap.biz// [Cannot connect to host vadbi1l.nwtrial.od.sap.biz:30015 [Connection refused (Connection refused) (local port 58788 to address 0.0.0.0, remote port 30015 to address 10.117.96.92 (vadbi1l.nwtrial.od.sap.biz))], -813.].)

enter image description here

Hana数据库,端口号为enter image description here enter image description here

enter image description here

enter image description here

Geoserver log

hana geoserver geotools hana-cloud-platform
3个回答
2
投票

从快速查看code看来,Hana数据存储区似乎不使用提供的端口信息。

public String buildUrl() {
    StringBuilder sb = new StringBuilder();
    sb.append("jdbc:sap://");
    sb.append(host);
    sb.append("/?instanceNumber=");
    sb.append(Integer.toString(instance));
    if ((database != null) && !database.isEmpty()) {
        sb.append("&databaseName=");
        sb.append(database);
    }
    return sb.toString();
}

我不太了解Hana说这是不是一个bug。但你可以在project jira提出错误报告或增强请求。


1
投票

mvnrepository下载gt-jdbc-hana-21.0源代码,在下面的类中更改代码

在HanaDataStoreFactory类中更改getJDBCUrl方法

     @SuppressWarnings({"rawtypes", "unchecked"})
        @Override
        protected String getJDBCUrl(Map params) throws IOException {
                    String host = (String) HOST.lookUp(params);
                    int instance = (Integer) INSTANCE.lookUp(params);
                    String database = (String) DATABASE.lookUp(params);
              Integer port = (Integer) PORT.lookUp(params);
                   HanaConnectionParameters cp = new HanaConnectionParameters(host, instance,
             database,port);
                 return cp.buildUrl();
    } 

在HanaConnectionParameters类中

/*
 *    GeoTools - The Open Source Java GIS Toolkit
 *    http://geotools.org
 *
 *    (C) 2018, Open Source Geospatial Foundation (OSGeo)
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
 *    version 2.1 of the License.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 */
package org.geotools.data.hana;

/**
 * SAP HANA connection parameters.
 *
 * @author Stefan Uhrig, SAP SE
 */
public class HanaConnectionParameters {

    /**
     * SAP HANA connection parameters constructor.
     *
     * @param host The database host.
     * @param instance The database instance.
     * @param database The name of the tenant database. Set to null or empty string if the database
     *     is a single-container system. Set to SYSTEMDB to connect to the system database of a
     *     multi-container system.
     */
    public HanaConnectionParameters(String host, int instance, String database,int port) {
        super();
        this.host = host;
        this.instance = instance;
        this.database = database;
        this.port = port;
    }

    private String host;

    private Integer  instance;

    private String database;

    private Integer port;

    public String getHost() {
        return host;
    }

    public Integer getInstance() {
        return instance;
    }

    public String getDatabase() {
        return database;
    }

    public Integer getPort() {
        return this.port;
    }
    /**
     * Builds a JDBC connection URL.
     *
     * @return Returns the JDBC connection URL corresponding to these parameters.
     */
    public String buildUrl() {

         String url = "jdbc:sap://" + this.host + ":" + this.port;
         return url;

    }
}

在各个班级进行更改后,从gt-jdbc-hana-21.0复制pom内容。建立你的maven并拿走罐子。


0
投票

不是HANA不强制使用端口号,因为实例号用于派生它。

端口号围绕实例编号构建,实际上如下所示:3

因此,如果您使用实例编号进行连接,那么您的客户端将首先实际联系SYSTEM DB。

SYSTEM DB的默认端口后缀为13。

使用HANA 1.0时,默认实例编号为00,因此使用的端口将为30013以联系SYSTEM DB。使用HANA 2.0时,默认实例编号为90,因此使用的端口将为39013以联系SYSTEM DB。

然后,您的客户端将询问SYSTEM DB您要连接的DB的端口后缀或默认DB的端口。默认数据库通常命名为HDB(或HXE for SAP HANA,Express版本。

默认DB的默认端口后缀为15。

然后您的客户端将直接连接到正确的端口。

所以,当你没有提供端口号使它变短时,这是怎么回事: - 转到系统db并询问正确的端口然后连接到它

真正重要的是检查防火墙是否阻止连接(您可以使用telnet来验证)。

因此,为了使其工作,您需要在实例属性中设置端口号。

© www.soinside.com 2019 - 2024. All rights reserved.