cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot retrieve the HANA Catalog Name

Former Member
0 Kudos

Hi all,

I have a Java program that has to connect to a HANA database via JDBC to do some CRUD operations.

When I create the JDBC connection I try to retrieve the Catalog Name of the HANA db, but it is null.

These are the steps that I do:

java.sql.Connection conn = getConnection(); // get the connection from the Context

String catalogName = conn.getCatalog();

catalogName is null!

I am using Java 1.6 and the application runs on JBoss 7.

Please,

can anyone help me?

Accepted Solutions (1)

Accepted Solutions (1)

lbreddemann
Active Contributor
0 Kudos

Hi Gennaro,

as SAP HANA currently does not support multiple databases, the return value of getCatalog() is correctly NULL.

This is in full compliance with the specification of the method (http://docs.oracle.com/javase/6/docs/api/java/sql/Connection.html#getCatalog() and http://jcp.org/en/jsr/detail?id=221).

- Lars

Former Member
0 Kudos

Hi Lars,

thank you very much for your response so quickly!

I understand and of course it is correct, but I was thinking to Oracle: if I am not in wrong, also Oracle does not support multiple databases but if I call getCalatolg() on a Connection on it, it returns me the Schema name.

I was expecting something like this.

Thank you again and best regards,

Gennaro.

lbreddemann
Active Contributor
0 Kudos

Well, as of Oracle 12c Oracle indeed does support multiple databases (called pluggable databases).

Not sure, if the Oracle JDBC driver always delivered the current schema where it was supposed to deliver the catalog (note: a catalog can contain multiple schemas. It's the list of all db objects for the current database) - I would consider this to be non-compliant with the JDBC specs. To me, it would make sense to present the database name then...

Anyway: this is how things are and I'm somewhat confident that as soon as SAP HANA supports multiple databases in a system, that getCatalog() will deliver the corresponding information as well.

For now, NULL is a correct return value for this method on SAP HANA.

- Lars

Former Member
0 Kudos

Ok,

thanks a lot for your help.

Regards,

Gennaro.

Answers (0)