Connecting an Oracle DB Container and a Java application Container (Docker) -


i working on docker project 2 docker containers - 1 oracle db , other java application.

the container oracle db working ok. used built image oracle , created tablespaces , users in it.

commands used pull , use oracle db container given below:

docker pull wnameless/oracle-xe-11g  docker run -d -p 49160:22 -p 49161:1521 -e oracle_allow_remote=true wnameless/oracle-xe-11g 

now have own java application interacts oracle db , run using command given below:

docker run -it --name mypgm myrepo/oracletesting 

it runs interactive java program asks oracle db details , allows users interact db.

however not figure out how have specify details such driver name, connection url, username, , password

the values gave given below:

driver name: oracle.jdbc.oracledriver connection url:jdbc:oracle:thin:@localhost:1521:orcl11g username: imtheuser password: **********

i dont know whats going wrong not working. tried giving different inputs connection url after inspecting docker container ip address well:

connection url: jdbc:oracle:thin:@172.17.0.2:1521:orcl11g

am giving connection url and/or port number correct? can me out correctly connect these 2 containers , project moving?

thanks kind help..

you have link containers. oracle container should have name.

try following:

    docker network create my-network # create network containers     docker run -d -p 49160:22 -p 49161:1521 --network my-network --name oracle-db -e oracle_allow_remote=true wnameless/oracle-xe-11g     docker run -it --network my-network --name mypgm myrepo/oracletesting 

use connection url following string jdbc:oracle:thin:@oracle-db:1521:orcl11g


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -