As specified in the title, I want to get the database name in sqlserver, all info I know is datasource name, login name/password to get the Connection object, please show some pointers on how to retrieve the database name correctly, in java, thanks!
Even
Obtain an instance of
java.sql.DatabaseMetaDatafrom the connection object.The names of database can be obtained via
getCatalogs()orgetSchemas()method (It depends upon the vendor of JDBC driver).Or use
Connection.getCatalog()orConnection.getSchema()method.In case if you are interested to get
host nameorip addressof the Oracle database server.