Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting to Oracle XE 21c running in Docker container #1537

Closed
jmc420 opened this issue Dec 16, 2022 · 2 comments
Closed

Connecting to Oracle XE 21c running in Docker container #1537

jmc420 opened this issue Dec 16, 2022 · 2 comments
Labels

Comments

@jmc420
Copy link

jmc420 commented Dec 16, 2022

I am running Oracle XE 21c in a Docker container and I can connect to it with a JDBC thin connection using the JDBC url jdbc:oracle:thin:@localhost:1521:XE using the SYSTEM account. I can also connect with sqlplus either by logging into the terminal Docker instance or by using sqlplus on the host OSX machine.

When I try to connect to it using NodeJS OracleDB example code described here:

https://node-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html, I cannot get the client to connect using either:

connection = await oracledb.getConnection({
      user          : "hr",
      password      : mypw
      connectString : "localhost/XEPDB1"
    });

or

 connection = await oracledb.getConnection({
    user          : "SYSTEM",
    password      : "MyPassword",
    connectString : "localhost/XE"
   });

I get an error ORA-01017: invalid username/password; logon denied.

sqlplus works fine if I use this connection string sqlplus SYSTEM/Password@localhost:1521/XE

if I change the code to:

     const connection = await oracledb.getConnection({
                    //user: connectionURI.user,
                    //password: connectionURI.password,
                    connectString: "SYSTEM/Password@localhost:1521/XE"
                });

I get the error ORA-12154: TNS:could not resolve the connect identifier specified

It seems odd that I can connect with sqlplus but not with node-oracledb. Any ideas?

@cjbj
Copy link
Member

cjbj commented Dec 16, 2022

Do you have a case sensitive password?

I would expect this syntax to work:

 connection = await oracledb.getConnection({
    user          : "SYSTEM",
    password      : "MyPassword",
    connectString : "localhost/XE"
   });

or with connectString : "localhost/XEPDB1"

This is not valid syntax for node-oracledb: connectString: "SYSTEM/Password@localhost:1521/XE"

There is no default password for the HR user. You can create the HR user using the scripts in https://github.com/oracle-samples/db-sample-schemas

@jmc420
Copy link
Author

jmc420 commented Dec 17, 2022

Thanks, It's now all working.

@jmc420 jmc420 closed this as completed Dec 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants