Oracle - 使用 MS Access 的 ODBC 连接错误 (ORA-12154)
我正在尝试使用 MS Access 连接到 Oracle 数据库。 我不断收到以下错误消息:
ORA-12154: TSN- 无法解析指定的连接标识符
Oracle 驱动程序 OracleClient10g 可以验证数据库服务器是否存在。
我的 tsnnames.ora 文件中有一个部分如下所示: UBASEP10G = (描述= (地址列表= (地址 = (协议 = TCP)(主机 = bxxx-xxx.yyyy.com)(端口 = 1521)) ) (连接数据= (服务名称=UBASE) ) )
根据我尝试解决此错误的方法,我将其添加到 sqlnet.ora 文件中:
NAMES.DIRECTORY_PATH= (HOSTNAME, ONAMES, TNSNAMES,LDAP,EZCONNECT)
当使用 Windows ODBC 驱动程序配置实用程序时,它会要求以下内容 以下信息 数据源名称:我的源名称 TSN 服务名称:UBASEP10G USERID:MYUSERID
有什么建议吗???
I am trying to use MS access to connect to a Oracle database.
I keep on getting the following error message:
ORA-12154: TSN- could not resolve the connect identifier secified
The Oracle Drivers OracleClient10g can verify that the database server exists.
I have a section in my tsnnames.ora file that looks like this:
UBASEP10G =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = bxxx-xxx.yyyy.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = UBASE)
)
)
per my attempts to get this error resolves I added this to the sqlnet.ora file:
NAMES.DIRECTORY_PATH= (HOSTNAME, ONAMES, TNSNAMES,LDAP,EZCONNECT)
When using the Windows ODBC driver configuration utility it asks for the following
following information
DATA SOURCE NAME : MYSOURCE NAME
TSN SERVICE NAME:UBASEP10G
USERID:MYUSERID
any suggestions ?????
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我没有 Access,但使用 Excel 2007,我必须执行以下操作:
I don't have Access, but using Excel 2007, I had to do the following:
尝试在 TNSNAMES.ora 文件中将 (CONNECT_DATA = (SERVICE_NAME = UBASE) ) 更改为 (CONNECT_DATA = (SID = UBASE) ) 。
ServiceName 和 SID 不一定相同,因此并不总是可以互换。
SERVICENAME 参数引用数据库服务器上的listener.ora 文件中指定的特定GLOBAL_DBNAME。 它是服务器上实例的别名。 一台服务器上可以有多个引用相同 SID 的服务名称。 SID 参数指的是该服务器上的特定实例。
在客户端使用服务名称的优点是,DBA 可以对使用该名称的客户端透明地更改服务名称所引用的实际实例。 我可以将其放在服务器上的listener.ora文件上:
稍后,我可以通过切换listener.ora配置来更改所引用的实际数据库:
并且客户端上没有人更明智。 无需对客户端上的 tnsnames.ora 文件进行任何更改。
Try changing (CONNECT_DATA = (SERVICE_NAME = UBASE) ) to (CONNECT_DATA = (SID = UBASE) ) in your TNSNAMES.ora file.
ServiceName and SID aren't necessarily the same and consequently aren't always interchangeable.
The SERVICENAME parameter refers to a particular GLOBAL_DBNAME specified in the listener.ora file on the database server. It's an alias for an instance on the server. You can have multiple servicenames on a server referring to the same SID. The SID parameter refers to a particular instance on that server.
The advantage of using servicename on the client side is that the DBA can change the actual instance being referenced by a servicename transparently to the clients using that name. I can have this on the server listener.ora file:
Later, I can change the actual database being referenced by switching the listener.ora configuration:
and nobody's the wiser on the client side. No changes were necessary in the tnsnames.ora files on the clients.
您可以通过 SQL*Plus 登录到有问题的数据库吗? 从另一台具有工作连接的计算机(或数据库服务器本身)执行此操作也可以。
如果是这样,请运行以下命令:
在 TNSNAMES.ORA 中,使用其中列出的 SERVICE_NAME 值之一。
在 ODBC 连接中,您只需将 TNS 服务名称设置为上面使用的名称“UBASEP10G”
Can you log in to the database in question via SQL*Plus? Doing this from another machine with a working connection (or the DB server itself) is fine also.
If so, run this:
In your TNSNAMES.ORA, use one of the values listed there for the SERVICE_NAME.
In you ODBC connection, all you'll need is to set the TNS Service Name to the name you used above, "UBASEP10G"
让我们回到第一个方面。 打开命令窗口并连接到数据库:
sqlplus myuserid/mypassword@UBASEP10G
连接成功吗?
既然答案是否定的,有没有办法可以成功连接到这个数据库? BQ是正确的,你的问题是UBASE的服务名。 您需要确定服务器上的侦听器认为该数据库的名称是什么。 您有权访问服务器吗? 您可以在服务器上执行命令“lsnrctl status”吗? 这将告诉您向侦听器注册的服务,如下所示:
Let's back up to square one. Open a command window and connect to your database:
sqlplus myuserid/mypassword@UBASEP10G
Does this connect successfully?
Since the answer is no, is there a way you CAN connect successfully to this database? BQ is correct, your problem is with the servicename of UBASE. You need to determine what the listener on the server thinks the name of that database is. Do you have access to the server? Can you execute the command "lsnrctl status" on the server? This will tell you the services that are registered with the listener, and look something like this:
尝试 tnsping 并报告您的结果。
坏:
好:
Try tnsping and report your results.
Bad:
Good: