简体   繁体   English

在Windows上连接到Oracle数据库

[英]connecting to oracle database on Windows

I have two machines on my network: 我的网络上有两台计算机:

  1. pc-1 is running on Windows XP SP3 , IP 192.168.1.15 pc-1Windows XP SP3上运行,IP 192.168.1.15
  2. pc-2 is running on Windows Vista , IP 192.168.1.16 pc-2Windows Vista上运行,IP 192.168.1.16

Now I have loaded Oracle 11gR2 on pc-2 (Vista) and the listener is running with the following settings: address=192.168.1.16 and port=1065. 现在,我已经在pc-2 (Vista)上加载了Oracle 11gR2 ,并且侦听器正在使用以下设置运行: address=192.168.1.16 and port=1065.

I am trying to connect to Oracle database via pc-1 (XP) using jdbc thin driver but I get the error The network adapter could not establish the connection. 我正在尝试使用jdbc thin driver通过pc-1 (XP)连接到Oracle数据库,但出现错误网络适​​配器无法建立连接。
My JDBC url : jdbc:oracle:thin:@192.168.1.16:1065:ora 我的JDBC url :jdbc:oracle:thin:@ 192.168.1.16:1065:ora

The pc-2 is reachable, I checked it by ping 192.168.1.16 pc-2可以访问,我通过ping 192.168.1.16进行了检查

I tried a few things from PC-1 : 我尝试了PC-1的一些功能:

  • TELNET 192.168.l.16 1065 gives error Connecting To 192.168.1.16...Could not open connection to the host, on port 1065: Connect failed. TELNET 192.168.l.16 1065给出错误连接到192.168.1.16 ...无法打开与主机的连接,端口1065:连接失败。 The firewall on pc-2 (vista+oracle) is turned off so I don't think firewall is blocking port 1065. firewall上的PC-2(+ Vista的甲骨文)被关闭,所以我不认为防火墙阻止端口1065。

  • tnsping 192.168.1.16:1065 gives error TNS-12535: TNS:operation timed out tnsping 192.168.1.16:1065给出错误TNS-12535:TNS:操作超时

  • sqlplus sys/sys@//192.168.1.16:1065/ora as sysdba but it gives error sqlplus sys/sys@//192.168.1.16:1065/ora as sysdba但它给出了错误

    ERROR:ORA-12170: TNS:Connect timeout occurred 错误:ORA-12170:TNS:发生连接超时

Some of the commands output on PC-2 PC-2上输出的一些命令

  • netstat -a

LOCAL ADDRESS ------------ FOREIGN ADDRESS -------------- STATE LOCAL ADDRESS ------------ FOREIGN ADDRESS -------------- STATE
192.168.1.16:1065----------------- PCNAME -------------------LISTENING 192.168.1.16:1065----------------- PCNAME ------------------- LISTENING

Can anyone please specify in details what shall I do? 谁能详细说明我该怎么办? I am trying to do this first time so no idea about what is going wrong? 我第一次尝试这样做,所以不知道出了什么问题?

You have to give the proper SID details in the tnsnames.ora file located under 您必须在下面的tnsnames.ora文件中提供正确的SID详细信息

for Linux: /home/oracle/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora 对于Linux:/home/oracle/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora

You don't say how you're connecting - I am assuming through TNS? 您没有说您的连接方式-我是通过TNS来假设的?

Did you specify the port of 1065 in your TNSNAMES.ORA file on the XP system? 您是否在XP系统上的TNSNAMES.ORA文件中指定了1065端口?

Can you connect from your XP system using EZCONNECT? 可以使用EZCONNECT从XP系统连接吗? That takes tnsnames.ora out of the equation. 这将tnsnames.ora排除在等式之外。

sqlplus user/pw@//192.168.1.16:1065/db_name

ERROR:ORA-12170: TNS:Connect timeout occurred 错误:ORA-12170:TNS:发生连接超时

this error usually means failure network connection 此错误通常表示网络连接失败

It's simple 这很简单

shut down your windows firewall 关闭您的Windows防火墙

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM