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

How do I connect to Oracle? #232

Closed
Fatroundfox opened this issue Feb 9, 2022 Discussed in #130 · 7 comments
Closed

How do I connect to Oracle? #232

Fatroundfox opened this issue Feb 9, 2022 Discussed in #130 · 7 comments

Comments

@Fatroundfox
Copy link

I keep getting this error message. Any idea what might be wrong? My login credentials and DSN are all correct. tsnnames.ora file are also in the environment variable. However, I just cannot connect.

This is what I currently have:
import connectorx as cx

conn = f"oracle://username:mypassword!001@dsn"
query = 'select * from table"

data = cx.read_sql(conn , query=query)

This is the error message:
"timed out waiting for connection: OCI Error: ORA-12154: TNS:could not resolve the connect identifier specified"

@wangxiaoying
Copy link
Contributor

Hi @Fatroundfox , the separator of DSN should be "/" instead of "@", the connection string should look like this:

oracle://${ORACLE_USER}:${ORACLE_PASSWORD}@${ORACLE_HOST}:${ORACLE_PORT}/${ORACLE_DB}

@Fatroundfox
Copy link
Author

Hi, already changed the format to oracle://${ORACLE_USER}:${ORACLE_PASSWORD}@${ORACLE_HOST}:${ORACLE_PORT}/${ORACLE_DB}, but I am still getting the same error message.

@wangxiaoying
Copy link
Contributor

Hi @Fatroundfox , can you try to use command line tool like sqlplus on the same machine to see whether it can connect to the database? Here is the example command:

sqlplus ${ORACLE_USER}/${ORACLE_PASSWORD}@${ORACLE_HOST}:${ORACLE_PORT}/${ORACLE_DB}

@OAlsalmi
Copy link

I have the same issue, tried throug sqlplus but got same message

@wangxiaoying
Copy link
Contributor

Hi @LifeHuntX , looks like your machine is not reachable from the client machine since sqlplus also shows the same message.

@OAlsalmi
Copy link

Oddly enough, when i use cx_Oracle package, or sql developer i can connect fine. But this method gives me no TNS:listener error. Would highly appreciate any help on that.

@OAlsalmi
Copy link

I upgraded to 0.2.4 and the issue is solved, can connect now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants