Reputation: 1081
I'm trying to connect to SAP HANA 2.0 using JDBC. I took the driver ngdbc.jar
from the Eclipse plugin that I installed in Windows.
Problem is that I always get the same error [Connection refused: connect], -813
even when I set a random IP address in the connection string.
The Eclipse plugin connects perfectly:
What could be the problem? This is the ngdbc.jar
trace:
ClassLoader: sun.misc.Launcher$AppClassLoader@73d16e93
Process-ID: 3140
package package com.sap.db.jdbc, Java Platform API Specification, version 1.6, SAP HANA JDBC Driver, SAP SE, 2.0.14-2d2417a0b831eafc24c4a6d30206b73d62a858e5 on Java 1.8.0_131
---- Thread 3e3abc88 main Timestamp: 2017-07-11 22:47:06.243
new Connection 'jdbc:sap://192.168.1.85:39015/'
user=SYSTEM
password=***
HOSTLIST: [192.168.1.85:39015,]
new RTEException: SQLSTART_REQUIRED(5) -813 Cannot connect to host 192.168.1.85:39015 [Connection refused: connect], -813.
whereAmIjava.lang.Throwable
at com.sap.db.jdbc.trace.Tracer.whereAmI(Tracer.java:333)
at com.sap.db.jdbc.exceptions.RTEException.<init>(RTEException.java:46)
at com.sap.db.jdbc.exceptions.RTEException.<init>(RTEException.java:23)
at com.sap.db.jdbc.Session._openSocket(Session.java:1005)
at com.sap.db.jdbc.Session.openSocket(Session.java:416)
at com.sap.db.jdbc.Session$1.open(Session.java:915)
at com.sap.db.jdbc.Topology.getSession(Topology.java:214)
at com.sap.db.jdbc.Driver._connect(Driver.java:814)
at com.sap.db.jdbc.Driver.connect(Driver.java:159)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at fdic.LoadBankReferenceData$.delayedEndpoint$fdic$LoadBankReferenceData$1(LoadBankReferenceData.scala:20)
at fdic.LoadBankReferenceData$delayedInit$body.apply(LoadBankReferenceData.scala:12)
at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.collection.immutable.List.foreach(List.scala:381)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
at scala.App$class.main(App.scala:76)
at fdic.LoadBankReferenceData$.main(LoadBankReferenceData.scala:12)
at fdic.LoadBankReferenceData.main(LoadBankReferenceData.scala)
using null
=> FAILED
And this is the code (in Scala):
Class.forName("com.sap.db.jdbc.Driver");
val conn = DriverManager.getConnection("jdbc:sap://192.168.1.85:39015/",
"SYSTEM", "xxxxx");
UPDATE
The code below throws the exact same error (this time in Java to rule out Scala problems):
Class.forName("com.sap.db.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:sap://192.168.1.85:39015/?databaseName=VBK_BANK_0001",
"VBK_BANK_0001", "xxxxxxx");
I get the same error: [Cannot connect to host 192.168.1.85:39015 [Connection refused: connect], -813.]
In Elipse:
Upvotes: 0
Views: 8825
Reputation: 10396
You seem to try to connect to the SystemDB of a multi-database-container (MDC) setup of HANA. As the SystemDB is special and don't run in an indexserver process, you would use a different port (...13) to connect to it. However, usually one would want to connect to a tenant database instead. For this, the jdbc URL needs to contain then name of the database as a parameter. The HANA documentation contains the details on this.
Upvotes: 2