0

I have a java application which will be deployed to Oracle Java Cloud Service. I have created a table in Oracle Database cloud service and have created a data source in Java cloud service. My datasource is up and running. Now pro-grammatically I am trying to connect to DB as shown below.

OracleConnection conn=null;
    javax.sql.DataSource ds=null;
    Hashtable env = new Hashtable();
    env.put( Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory" );
    env.put(Context.PROVIDER_URL, "https://<host>:7002");


    try{
      Context context=new InitialContext( env );
      //you will need to have create a Data Source with JNDI name testDS
      ds=(javax.sql.DataSource) context.lookup ("jdbc/testDS");
      conn=(OracleConnection) ds.getConnection();
      java.util.Properties prop = new java.util.Properties();
      System.out.println("Connection object details : "+conn);
      conn.close();
    }catch(Exception ex){
      //handle the exception
        System.out.println("Exception "+ ex);
    }

And I am getting below mentioned issue

Exception javax.naming.CommunicationException: https://<host>:7002: [RJVM:000575]Destination <host>, 7002 unreachable.; nested exception is:
  javax.net.ssl.SSLHandshakeException: General SSLEngine problem; [RJVM:000576]No available router to destination.; nested exception is:
  java.rmi.ConnectException: [RJVM:000576]No available router to destination. [Root exception is java.net.ConnectException: https://<host>:7002: [RJVM:000575]Destination <host>, 7002 unreachable.; nested exception is:
  javax.net.ssl.SSLHandshakeException: General SSLEngine problem; [RJVM:000576]No available router to destination.; nested exception is:
  java.rmi.ConnectException: [RJVM:000576]No available router to destination.]

Could any one please suggest me the solution for above issue?

James Z
  • 12,209
  • 10
  • 24
  • 44
  • 1
    I'm assuming that here env.put(Context.PROVIDER_URL, "https://:7002"); -- you have actually replaced with your actual servername/IP ? – thatjeffsmith Jun 22 '17 at 18:29
  • Try to telnet the host:7002 from the box you're running the code on. – access_granted Jun 22 '17 at 20:27
  • Hi, yes. I have replaced the with actual servername/ip. – user8201218 Jun 23 '17 at 04:39
  • instead of https://:7002, i tried with t3://:7002 , but it is showing Exception e javax.naming.CommunicationException: [Login failed for an unknown reason. issue. i am passing username and password as follows env.put(Context.SECURITY_PRINCIPAL, "weblogic"); env.put(Context.SECURITY_CREDENTIALS,"welcome1"); where weblogic is my username and welcome1 is my password. is there any additional properties i need to pass? please suggest – user8201218 Jun 23 '17 at 07:32

0 Answers0