Forum Stats

  • 3,758,186 Users
  • 2,251,351 Discussions
  • 7,870,100 Comments

Discussions

Getting exception while connecting to oracle database using JSP program.

Bitra Hemanth
Bitra Hemanth Member Posts: 69
edited Dec 14, 2018 12:56AM in Java User Groups Discussions

Hello team,

I have create a jsp program and added in tomcat docker while testing in local desktop i am getting below exception.

java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection.

i am using oracle database 12c docker.

First i have create below stack file.

stack file:

version: "3.7"

services:

  oracle:

    image: sath89/oracle-12c:latest

    ports:

      - "8080:8080"

      - "1521:1521"

    stop_grace_period: 1m0s

    deploy:

      replicas: 1

      restart_policy:

        condition: on-failure

        max_attempts: 3

    networks:

      - fronter

  jsp:

    image: bitroid/jsp-db-docker

    ports:

      - "8888:8080"

    networks:

      - fronter

    depends_on:

      - oracle

    deploy:

      replicas: 1

      restart_policy:

        condition: on-failure

        max_attempts: 3

networks:

  fronter:

after creating above stack file i used below command to deploy docker in local system.

$docker stack deploy jsp_oracle -c pwdcmdstack.yml

and after deploying i have provisioned oracle database docker with below scripts.

docker exec -it --user root jsp_oracle_oracle.1.zqz4r7k4x1cxdagh9fj415u5p /bin/bash -c "apt-get update -y;apt-get install git -y --force-yes"

docker exec -it --user root jsp_oracle_oracle.1.zqz4r7k4x1cxdagh9fj415u5p /bin/bash -c "git clone https://github.com/hemanth22/Oracle_database.git"

docker exec -it --user root jsp_oracle_oracle.1.zqz4r7k4x1cxdagh9fj415u5p /bin/bash -c "chmod -R 777 Oracle_database;cd /Oracle_database;ls -la"

docker exec -it --user oracle jsp_oracle_oracle.1.zqz4r7k4x1cxdagh9fj415u5p /bin/bash -c "netstat -nlpt"

docker exec -it --user oracle jsp_oracle_oracle.1.zqz4r7k4x1cxdagh9fj415u5p /bin/bash -c "ls && cd Oracle_database && ls && bash login.sh"

Can you please check and advice how get ride of the java.sql.SQLRecoverableException

Thanks and regards,

Hemanth.

Best Answer

Answers