Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Question about JDBC connection

Former Member
0 Likes
997
  • SAP Managed Tags

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/ff15928cf5594d78b841fbbe64...

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

4 REPLIES 4
Read only

0 Likes
897
  • SAP Managed Tags

Which Java SDK package are you using?

Version?

Read only

0 Likes
897
  • SAP Managed Tags

Hello,

I use JDK 1.8

Read only

0 Likes
897
  • SAP Managed Tags

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

Read only

0 Likes
897
  • SAP Managed Tags

I use the jar file : ngdbc.jar