使用service_name连接oracle db而不是使用ojdbc14.jar驱动程序在weblogic Server中使用JDK 3的SP1中的jar驱动程序而不是SID

发布于 01-18 18:43 字数 925 浏览 6 评论 0原文

在开发遗留应用程序时,第一个文件可以追溯到 2005 年。 它用于创建映射到应用程序连接的数据源的连接池,

URL: jdbc:oracle:thin:@host.test.intranet:1521:service_name
Driver Classname:oracle.jdbc.driver.OracleDriver
Properties(key=value):
user=makeduser
password=maskedpassword
dll=ocijdbc8
protocol=thin

ACLName: null

最近,数据库被重新托管,新的连接详细信息从 SID 更改为 Service_name

当尝试使用相同的格式“host”port:sid”时,

它返回的错误当weblogic服务器启动时 无法启动连接池“veroPool”weblogic.common.ResourceException:无法>创建池连接。 DBMS 驱动程序异常为:java.sql.SQLException:Io 异常:> 连接被拒绝(DESCRIPTION=(TMP=)(VSNNUM=318767104)(ERR=12505)(ERROR_STACK=(ERROR=>(CODE=12505)( EMFI=4))))

并且当尝试使用以下格式时:

jdbc:oracle:thin:@//NEWHOST.TEST.INTRANET:1521/NEW-SERVICE_NAME

返回的错误是:

无法启动连接池“veroPool”weblogic.common.ResourceException:无法创建池连接。 DBMS 驱动程序异常为:java.sql.SQLException:Io 异常:连接字符串格式无效,有效格式为:“host:port:sid”

While Working on a legacy application that first file date back to year 2005.
It used to create connection pool that is mapped to DataSource that application connects with,

URL: jdbc:oracle:thin:@host.test.intranet:1521:service_name
Driver Classname:oracle.jdbc.driver.OracleDriver
Properties(key=value):
user=makeduser
password=maskedpassword
dll=ocijdbc8
protocol=thin

ACLName: null

Recently, the db got rehosted and the new connection details changed from SID to Service_name

While trying to use same format "host"port:sid"

The error that it returns when weblogic server is started
Cannot startup connection pool "veroPool" weblogic.common.ResourceException:Could not >create pool connection. The DBMS driver exception was:java.sql.SQLException: Io exception: >Connection refused(DESCRIPTION=(TMP=)(VSNNUM=318767104)(ERR=12505)(ERROR_STACK=(ERROR=>(CODE=12505)(EMFI=4))))

And When trying to use following format:

jdbc:oracle:thin:@//NEWHOST.TEST.INTRANET:1521/NEW-SERVICE_NAME

Error returned is:

Cannot startup connection pool "veroPool" weblogic.common.ResourceException:Could not create pool connection. The DBMS driver exception was: java.sql.SQLException: Io exception: Invalid connection string format, a valid format is: "host:port:sid"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

转角预定愛2025-01-25 18:43:13

此驱动版本不支持以这种格式在 url 中传递的服务名称,因此您必须使用 SID。尝试连接到数据库并使用以下查询获取 SID:

select sys_context('userenv','instance_name') from dual; 

然后您可以在连接 url 中使用从查询返回的 SID:

jdbc:oracle:thin:@host.test.intranet:1521:SID

或者,您可以尝试使用以下语法来指定支持此驱动程序版本的服务名称的连接:

jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = <HOST>)(PORT = <PORT>))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = <SERVICE_NAME>)))

This driver version doesn't support the service name passed in the url in this format, so you have to use the SID. Try to connect to the DB and get the SID using the following query:

select sys_context('userenv','instance_name') from dual; 

Then you can use the SID returned from the query in your connection url:

jdbc:oracle:thin:@host.test.intranet:1521:SID

Alternatively you can try with the following syntax to specify your connection which suports service name for this driver version:

jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = <HOST>)(PORT = <PORT>))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = <SERVICE_NAME>)))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文