Using the Jar file ngdbc.jar (EDIT: invalid link to user's GitHub, see valid link in answer), I am able to make connection to a SAP HANA database, as is shown in this screenshot:
However I would like to know which one of the classes from the jar will actually contain the connection pool settings that I can use.
I would really appreciate it if some one can help me out with the method/class name. From the JAR I am trying to find the following information:
The ngdbc
JAR contains the SAP HANA JDBC driver. You can actually obtain it from Maven central: com.sap.cloud.db.jdbc:ngdbc. You should prefer this method rather than storing it on your GitHub - where you might actually infringe upon its license which does not allow for redistribution as far as I know.
The Driver implementation is com.sap.db.jdbc.Driver
. As you can see, drivers have a Connection connect(String url, Properties info) throws SQLException
method that you can use to connect to the database.
For managing pools of connections, I would recommend using a dedicate library like HikariCP or the Tomcat Connection Pool. Basically you would need to do something along the lines of:
HikariDataSource ds = new HikariDataSource();
ds.setJdbcUrl("jdbc:sap://localhost:30115/?databaseName=Test");
ds.setUsername("user");
ds.setPassword("password");
ds.setDriverClassName("com.sap.db.jdbc.Driver");
Alternatively, you can use the com.sap.db.jdbcext.HanaConnectionPoolDataSource
directly, which is included in the ngdbc JAR, but which is more limited in respect to performance and configuration options.
The SAP HANA reference documentation also covers the JDBC Application Programming topic with example programs.