Oracle EasyConnect 连接字符串使用 SID?
我正在尝试使用 EasyConnect 连接字符串通过代码(Ruby/DBI,但这无关紧要)连接到 Oracle 数据库。所有 Oracle 文档都规定将连接字符串指定为 //hostname:port/service_name。我没有需要连接的数据库的 service_name,而是有一个 SID。有没有办法使用 SID 而不是服务名称来创建 EasyConnect 连接字符串?
我的连接代码如下所示:
DBI.connect("DBI:OCI8://localhost:9000/the_sid", "username here", "password here")
我不断尝试不同的事情,并且取决于在我尝试的过程中,我收到两条错误消息之一:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor (DBI::DatabaseError)
ORA-12154: TNS:could not resolve the connect identifier specified (DBI::DatabaseError)
I'm trying to connect to an Oracle database through code (Ruby/DBI, but that's irrelevant) using an EasyConnect connection string. All of the Oracle documentation says to specify the connection string as //hostname:port/service_name. I don't have a service_name for the database that I need to connect to, I have a SID instead. Is there a way to create an EasyConnect connection string using a SID instead of a service name?
My connection code looks like this:
DBI.connect("DBI:OCI8://localhost:9000/the_sid", "username here", "password here")
I keep trying different things, and depending on what I try, I get one of two error messages:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor (DBI::DatabaseError)
ORA-12154: TNS:could not resolve the connect identifier specified (DBI::DatabaseError)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过使用 SID 作为服务名称?您通常可以在请求服务时指定 SID。 SERVICE_NAMES 通常默认为 SID。在 SQL 命令提示符下,输入:
VALUE 列中的值是数据库注册的服务名称。
Did you try the SID as the SERVICE name? You can usually specify a SID where a service is asked for. SERVICE_NAMES typically defaults to the SID. At a SQL command prompt, enter:
The value(s) in the VALUE column is/are the service name(s) the database is registered as.