从数据库连接字符串中获取数据库名称 [英] fetch database name from database connection string

查看:501
本文介绍了从数据库连接字符串中获取数据库名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我尝试从数据库连接字符串读取数据库名称时,它返回空字符串.我正在建立到Oracle的连接.我获得了数据库连接并返回了连接成功.

字符串dbname = dbConnection.getCatalog();

从上面的代码中,dbconnection是数据库连接对象.如果我以前使用getCatalog()方法获取数据库名称,则无法获取dbname.有人告诉我从数据库连接字符串中获取数据库名称的任何其他方法.

任何建议都可以理解.

Hi,

While i am trying to read database name from the database connection string it returns null string. i am establish the connection to the Oracle. i got the database connection and returns the connection success.

String dbname= dbConnection.getCatalog();

from the above code, dbconnection is is database connection object. if i used to get the database name using getCatalog() method not get the dbname. any one tell me any other way to get the database name from the database connection string.

any suggestions could be appreciated.

推荐答案

请参见

这篇关于从数据库连接字符串中获取数据库名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆