Skip to Content
avatar image
Former Member

Question about JDBC connection

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Sep 06, 2017 at 09:41 PM

    Which Java SDK package are you using?

    Version?

    Add comment
    10|10000 characters needed characters exceeded