简体   繁体   English

无法连接到Oracle DB,因为java.sql.SQLException而出现错误:Io异常:网络适配器无法建立连接

[英]Not able to connect to Oracle DB getting error as java.sql.SQLException: Io exception: The Network Adapter could not establish the connection

Here is the code which i am trying- ORACLE driver is loaded successfully but getting in get connection that statement- 这是我正在尝试的代码-ORACLE驱动程序已成功加载但进入该语句的连接-

public class OracelConn {
   public static void main(String[] args) throws Exception {
      try {
         try {
            Class.forName("oracle.jdbc.driver.OracleDriver");
         } catch (ClassNotFoundException e) {
            System.out.println("Please include Classpath  Where your ORACLE Driver is located");
            e.printStackTrace();
            return;
         }
         System.out.println("ORACLE driver is loaded successfully");
         Connectioncon=DriverManager.getConnection( "jdbc:oracle:thin:or0132p.exg.com:1521:OP0132.exg.com", "wsteam", "wsteam");

         Statement stmt = con.createStatement();
         ResultSet rs = stmt.executeQuery("select TC_ORDER_ID from orders where tc_order_id='0296906379'");
         while (rs.next())
            System.out.println(rs.getString("TC_ORDER_ID"));

         con.close();
         } catch (Exception e) {
             System.out.println(e);
         }
      }
   }

There seems to be an issue with your URL format. 您的URL格式似乎有问题。 Below are supported formats: 以下是受支持的格式:

If you have an SID, use this (older) format: 如果您有SID,请使用以下(较旧的)格式:

jdbc:oracle:thin:@[HOST][:PORT]:SID

If you have an Oracle service name, use this (newer) format: 如果您具有Oracle服务名称,请使用以下(较新的)格式:

jdbc:oracle:thin:@//[HOST][:PORT]/SERVICE

Source: orafaq 资料来源: orafaq

暂无
暂无

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

相关问题 获取“ java.sql.SQLException:Io异常:网络适配器无法建立连接” - Getting “java.sql.SQLException: Io exception: The Network Adapter could not establish the connection” java.sql.SQLException: IO 异常:网络适配器无法建立连接? - java.sql.SQLException: IO Exception : The Network adapter could not establish the connection? java.sql.SQLException:Io异常:网络适配器无法建立连接 - java.sql.SQLException: Io exception: The Network Adapter could not establish the connection java.sql.SQLException:网络适配器无法建立连接 - java.sql.SQLException: The Network Adapter could not establish the connection 获取'java.sql.SQLRecoverableException:IO错误:网络适配器无法建立连接',同时连接oracle数据库 - Getting 'java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection' while connecting oracle database SQLException:Io异常:网络适配器无法建立连接 - SQLException: Io exception: The Network Adapter could not establish the connection IO 错误:将 oracle DB 作为 docker 容器运行并尝试通过 Tomcat 连接时,网络适配器无法建立连接 - IO Error: The Network Adapter could not establish the connection when running oracle DB as docker container and trying to connect via Tomcat Java:Io异常:网络适配器无法建立连接 - Java : Io exception: The Network Adapter could not establish the connection IO 错误:将 oracle DB 作为 docker 容器运行时,网络适配器无法建立连接 - IO Error: The Network Adapter could not establish the connection when running oracle DB as docker container 出现IO错误:网络适配器无法建立连接 - getting IO Error: The Network Adapter could not establish the connection
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM