Øystein Seel
Øystein Seel

Reputation: 935

Invalid connectionstring for oracle ords docker image

I'm trying to connect my oracle database to ords. They are both running in their own docker image. I can easily connect to the database from both sqlcl and datagrip, using a jdbc-url: jdbc:oracle:thin:@//localhost:1521/ORCLCDB.localdomain

As mentioned in the description for the image I have created a volume directory and added a connectionstring txt file:

CONN_STRING=dummy/<pwd>@jdbc:oracle:thin:@//localhost:1521/ORCLCDB.localdomain
                
CONN_STRING=dummy/<pwd>@localhost:1521/ORCLCDB.localdomain

I've tried several different formats but keep getting the same error message:

ERROR: Cannot connect to database please validate CONN_STRING has below shape:
          user/password@hostname:port/service_name    

ORDS image

Upvotes: 1

Views: 1484

Answers (5)

Aymen Ayadi
Aymen Ayadi

Reputation: 1

I had the same issue for few days but I've resolved it by using the IP address of the database container and not localhost or 127.0.0.1. The containers were on the same --network tag but still worked only when I had given the IP address:

CONN_STRING="sys as sysdba/1230123@<ip_address>:1521/XEPDB1"

My suggestion to check what is misconfigured or used in your case.

Upvotes: 0

Jackson Barcellos
Jackson Barcellos

Reputation: 1

Add a blank line before the connection string in the file conn_string.txt and use it this way :

CONN_STRING="sys/1230123@oracledev:1521/XEPDB1 as sysdba"

Upvotes: 0

Robert Bakyayita
Robert Bakyayita

Reputation: 1

INFO : This container will start a service running ORDS 22.2.0 and APEX 22.1.0. INFO : CONN_STRING has been found in the container variables file. ERROR: Cannot connect to database please validate CONN_STRING has below shape: user/password@hostname:port/service_name

Upvotes: 0

Ulrik Larsen
Ulrik Larsen

Reputation: 139

I thought it was the password, but it turned out that the image gives the same response when the ORDS container cannot reach the database container. To solve this run

docker inspect testapex | grep IPAddress

to get the ip address of the database container in the network and then use it in the conn_string.txt file: CONN_STRING=sys/Welcome1##@123.12.0.2:1521/XEPDB1

Upvotes: 0

Roberto Hernandez
Roberto Hernandez

Reputation: 8518

Follow the documentation

CONN_STRING=user/password@host:port/service_name

So in your case

CONN_STRING=dummy/<pwd>@localhost:1521/ORCLCDB.localdomain

The CONN_STRING uses the format of a SQL-NET connection string, the same as you might have in the tnsnames.ora, or when you use direct connect.

user/password@host:port/service_name 

ORDS in docker

enter image description here

Update

I found also that the documentation states

user/password credentials require sysdba access, This user will be used to install/upgrade APEX and ORDS on you Database.

So I guess there is a contradiction between how the conn_string should be set, as the user requiring sysdba privileges. The only use who can do that is sys, thus try this

CONN_STRING=sys/sys_password@localhost:1521/ORCLCDB.localdomain as sysdba

Upvotes: 1

Related Questions