I created a container for an Oracle Express database following these instructions, with the following command:
docker run -d -e ORACLE_PWD="root" --name testdb -p 5500:5500 -p 8080:8080 -p 1521:1521 container-registry.oracle.com/database/express:21.3.0-xe
What does work
I managed to access the database from within the container with this command:
docker exec -it testdb sqlplus system/root@//localhost:1521/XE
I also managed to access to access the Oracle Enterprise Manager on localhost:5500/em
using these credentials:
- Username:
system
- Password:
root
- Container Name:
<blank>
What doesn’t work
I fail to connect using IntelliJ, and therefore the underlying JDBC library. I use the following options:
For Password, I used root
again, the JDBC URL is as follows:
jdbc:oracle:thin:@localhost:1521:XE
When I click on Test connection
, IntelliJ tries to connect for about a minute, before showing the following error
2
Answers
I worked perfectly well when I used the same configuration, but with this image instead of the official one.
Thanks to Bjarte Brandt for pointing me to this image.
I did a test on my MacOS
Note. Port is not needed, defaults to 1521
I cannot explain why you get the error. Can it be the JDBC version you are using? I have just proven, your connection should work. That said, you are not supposed to connect using the SID construct (:SID) anymore. You will hit the root-container and not where you are supposed to store your data – in a pluggable database. The express-edition comes with the default pluggable database "XEPDB1".
This should be your connect string:
From here you create your app schema and user so you no longer will use the power-user ‘system’.
Best of luck!