Skip to Content
0

Question about JDBC connection

Sep 06, 2017 at 09:41 PM

40

avatar image
Former Member

Hello all,

I'm developer and I have a question about jdbc connection HANA.

I have followed this documentation for my tests :

https://help.sap.com/viewer/52715f71adba4aaeb480d946c742d1f6/2.0.00/en-US/ff15928cf5594d78b841fbbe649f04b4.html

My HANA system is in multiple-database and scale-out with replication.

I have tested two method connection :

public class HanaUtil {


	public static Connection getConnectionFirstMethod() throws Exception {
		Properties p = new Properties();
		p.setProperty("autocommit", "false");
		p.setProperty("user", "****");
		p.setProperty("password", "****");
		p.setProperty("databaseName", "****");
		String uri = "jdbc:sap://localhost:30513";

		Connection connection = DriverManager.getConnection(uri, p);
		return connection;
	}


	public static Connection getConnectionSecondMethod() throws Exception {
		Properties p = new Properties();
	
		p.setProperty("autocommit", "false");
		p.setProperty("user", "****");
		p.setProperty("password", "****");

		String uri = "jdbc:sap://localhost:30544";

		Connection connection = DriverManager.getConnection(uri, p);

		return connection;
	}


}

Both methods works but, depending on the method called, I didn't have the same result for my request SQL : (and others)

"select * from SYS.M_DATABASES"

  • With the first method, the request return ALL databases of my HANA system.
  • With the second method, the request return only the current database.

And I would know why, and which method is the best pratice.

Thank a lot

F.Serkan

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Don Williams
Sep 06, 2017 at 09:41 PM
0

Which Java SDK package are you using?

Version?

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hello,

I use JDK 1.8

0

I meant which CR/BOE/CRS Java SDK package are you using?

0
Former Member

I use the jar file : ngdbc.jar

0