Tuesday, December 5, 2017

python cx_Oracle connect Remote error

Leave a Comment

i would like to connect to remote oracle database with python and try to create a pandas dataframe:

con = ora.connect('user/pass@remote_ip/XE') query = "select * from my_table"  df = pd.read_sql(query, con) 

I'm using macOS high siera and this is how my host file looks like:

## # Host Database # # localhost is used to configure the loopback interface # when the system is booting.  Do not change this entry. ## 127.0.0.1       localhost local 127.0.0.1 localhost localhost.localdomain local lynx 255.255.255.255 broadcasthost ::1             localhost 127.0.0.1     activate.adobe.com 127.0.0.1     practivate.adobe.com 127.0.0.1     hlrcv.stage.adobe.com 127.0.0.1     na1r.services.adobe.com 127.0.0.1 quickplayer.tvgo.hu 80.211.194.173 anton 10.2.94.217 lynx 

I got cx_Oracle.DatabaseError: ORA-21561: OID generation failed error.

If i try from Ubuntu it's working.

My Database version:

Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production PL/SQL Release 11.2.0.2.0 - Production CORE     11.2.0.2.0            Production TNS for Linux: Version 11.2.0.2.0 - Production NLSRTL Version 11.2.0.2.0 - Production 

What should I try?

1 Answers

Answers 1

Summary of the comments:

Run hostname to get what your OS thinks your name is.

In this case hostname returned QGMAC.local

Add this line to your hosts file:

127.0.0.1 QGMAC.local

From Don Burleson's site:

http://www.dba-oracle.com/t_ora_21561_oid_generation_failed.htm

"...the problem is most likely in the client machine hosts file. Check that there is client machine fully qualified name and short name in the client machine hosts file."

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment