当我尝试创建数据存储时,Geo服务器取错了端口号,因为我无法创建存储。数据库是sap云。
从SAP云,我推出了geoserver 2.14。在geoserver war中,我添加了gt-jdbc-hana-21.0.jar (由geotool提供)和**ngdbc.jar **。
在云端,我启动了geoserver,然后创建了工作区。然后我尝试创建数据存储。我填写了所需的所有字段。但是我给出的端口号是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.].)
带有端口号的Hana数据库
发布于 2019-03-20 06:54:35
从下面类中的mvnrepository储存库更改代码下载gt 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;
}
}
在相应的类中更改后,从21.0复制pom内容。造好你的行尸走肉,拿上罐子。
发布于 2019-03-12 09:36:48
通过快速查看代码,似乎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还不太了解,不知道这是不是个窃听器。但是,您可以在jira项目上引发错误报告或入侵请求。
发布于 2019-03-14 12:43:53
不,端口号在HANA中不是强制性的,因为实例号是用来派生它的。
端口号是围绕实例号构建的,实际上如下所示:3
因此,如果您使用实例号进行连接,那么您的客户端将首先与系统DB联系。
系统DB的默认端口后缀为13。
当使用HANA1.0(默认实例号为00 )时,所使用的端口将为30013,以便与系统DB联系。当使用HANA2.0时,默认的实例号为90,因此用于与系统DB联系的端口为39013。
然后,客户端会问系统DB,要连接的DB的端口后缀是什么,或者默认DB的端口是什么。默认DB通常命名为HDB (或用于SAP的HXE,速成版)。
默认DB的默认端口后缀为15。
然后你的客户将直接连接到正确的端口。
因此,当您不提供端口号以使其简短时,它就是这样的:-转到system并请求正确的端口,然后连接到它
真正重要的是检查您的防火墙没有阻止连接(您可以使用telnet验证)。
因此,要使其工作,您需要在实例属性中设置端口号。
https://stackoverflow.com/questions/55096693
复制相似问题