Layer7 API Management

Expand all | Collapse all

JDBC connection error

Jump to Best Answer
  • 1.  JDBC connection error

    Posted 05-23-2017 03:39 AM

    Hi All,

     

      I am not able to establish connection with Oracle 10g while doing JDBC test am getting below error, can you please help to get it fixed.

     

    error:

    Testing failed:invalid connection properties setting.

    [l7tech]Oracle JDBC Driver] Error establishing socket to host and port:192.168.0.5:1521. Reason:No route to host

     

     

    My connection details are like below:

    Driver Class: com.l7tech.jdbc.oracle.OracleDriver

    JDBC URL : jdbc:l7tech:oracle://192.168.0.5:1521;ServiceName=XE

    username= system

    password=******

     

     

    Note:

    1)Oracle server is running on windows machine.

    2)Am not able to ping my windows machine(where Oracle is running) from my gateway appliance, but I can able to ping from my windows machine to gateway appliance. So what network settings might be wrong here?

     

    We are using NAT network adapter for gateway appliance.

     

     

    Thanks in advance....

    Mustaq



  • 2.  Re: JDBC connection error
    Best Answer

    Posted 05-23-2017 08:53 AM

    Hello ,

     

    You can ping from Windows to the gateway but u cant ping from Gateway to Windows Machine. That only means that gateway is open which is replying to your ping request but as Windows is not able to reply the gateway ping request, there is something blocking the gateway request in the Windows. 

     

    Please first check that if any firewall is blocking your ping request in the Windows Machine. 
    Ping using only the IP. If you need to ping using the hostname then do Map the IP  to the hostname in the Windows Machine by going into the c: /Windows/system32/drivers/etc/hosts.

     

    While Connecting to the user which is 'system' in your case. You need to run a grant all permission script for the user 'SYSTEM' with the machine IP you're accessing the DATABASE.

    Please check the JDBC URL ur entering I guess it should be in below format

     jdbc:oracle://hostname:portNumber:databaseName

     

    Please Correct me if I am Wrong.

     

     

    Thanks !!!



  • 3.  Re: JDBC connection error

    Posted 06-07-2017 05:41 PM

    Make sure your DNS on Gateway is correctly configured. Make sure Firewall is not blocking ping and tcp port 1521 to and from Gateway.

     

    Next is to see if an explicit entry in the hosts file will solve the issue. Log into Gateway linux machine and get to root command line. Next type "Vi /etc/hosts" and add the <IP> <hostname> on a new line and save and exit the file (:wq). (EX: 192.168.1.12 gatewaya.ca.com). Then try to test your JDBC connection again or you could also issue a ping from Gateway to your Windows machine.

     

    If still having an issue then you may need to add some Static IP Routes to the routing table in standard linux manner or refer to our documenation below:

    Adding Static Routes
    Modification of Static Routes will require that the administrator connect to the root shell to add additional configuration. The steps below will outline what is required to enable this.

    1) Connect to the Gateway using either Console, ILOM or SSH as the ssgconfig user account

    2) From the ssgconfig menu, select option "3) Use a privileged shell (root)"

    3) At the root prompt add a new file /etc/sysconfig/static-routes

    Syntax:
       any net <NETWORK> netmask <NETMASK> gw <GATEWAY> <DEV>

    Example:
        any net 172.16.0.0 netmask 255.240.0.0 gw 192.168.0.1 eth0
        any net 10.0.0.0 netmask 255.0.0.0 gw 192.168.0.1 eth0


    4) (An alternative method) At the root prompt add a new file /etc/sysconfig/network-scripts/route-ethX with X representing the interface value. For every interface a file needs to created that associates static routes with the interface.There are 2 syntaxes that can be used.
    a) Legacy mechanism defines the GATEWAY, NETMASK and ADDRESS for each route explicitly.

    Syntax:
      GATEWAY#=<gateway>
      NETMASK#=<netmask>
      ADDRESS#=<network>

    Example:
      GATEWAY0=192.168.108.2
      NETMASK0=255.255.255.0
      ADDRESS0=192.168.34.0

      GATEWAY1=192.168.108.2
      NETMASK1=255.255.0.0
      ADDRESS1=10.1.0.0

    b) Modern mechanism uses CIDR notation to denote the subnet. (Recommended)

    Syntax:
     <network/cidr> via <gateway>

    Example:
      10.0.0.0/8 via 192.168.108.2
      192.168.32.0/24 via 192.168.108.2

    5) Once all the static routes are in place, reboot the Gateway to ensure that all routes are properly established.