Trying to get connecting Dabase Name using java

68 Views Asked by At
conn = jdbcTemplate.getDataSource().getConnection();

DatabaseMetaData databaseMetaData = conn.getMetaData();

oracleSchema = databaseMetaData.getUserName(); // Oracle gives me database name i am connecting to....

But is there is any specific method which gives me teradata database name?

1

There are 1 best solutions below

2
On BEST ANSWER

How about using SQL to get the database name. I think for teradata it is

SELECT defaultdatabase,sessionno
FROM Dbc.Sessioninfo where username='USR_NAME' ;