Error Connecting virtual machine to oracle, using python (error DPY-4011)

Question:

I’m using the oracledb library to connect my python application to an oracle database. I can connect normally using python on my computer, but I have a virtual machine, running Ubuntu, which is using the same network as the computer, that cannot connect. here is the output when I try:

Python: 3.8.10
Oracle: SE19
Conn. string: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=IP)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=NAME)(SERVER=dedicated)))

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/arthur/.local/lib/python3.8/site-packages/oracledb/connection.py", line 995, in wrapped
    return conn_class(dsn=dsn, pool=pool, params=params, **kwargs)
  File "/home/arthur/.local/lib/python3.8/site-packages/oracledb/connection.py", line 124, in __init__
    impl.connect(params_impl)
  File "src/oracledb/impl/thin/connection.pyx", line 309, in oracledb.thin_impl.ThinConnImpl.connect
  File "src/oracledb/impl/thin/connection.pyx", line 169, in oracledb.thin_impl.ThinConnImpl._connect_with_params
  File "src/oracledb/impl/thin/protocol.pyx", line 188, in oracledb.thin_impl.Protocol._connect
  File "src/oracledb/impl/thin/protocol.pyx", line 255, in oracledb.thin_impl.Protocol._process_message
  File "src/oracledb/impl/thin/protocol.pyx", line 233, in oracledb.thin_impl.Protocol._process_message
  File "src/oracledb/impl/thin/protocol.pyx", line 301, in oracledb.thin_impl.Protocol._receive_packet
  File "src/oracledb/impl/thin/buffer.pyx", line 1080, in oracledb.thin_impl.ReadBuffer.receive_packet
  File "src/oracledb/impl/thin/buffer.pyx", line 426, in oracledb.thin_impl.ReadBuffer._receive_packet_helper
  File "src/oracledb/impl/thin/buffer.pyx", line 293, in oracledb.thin_impl.ReadBuffer._get_data_from_socket
  File "/home/arthur/.local/lib/python3.8/site-packages/oracledb/errors.py", line 103, in _raise_err
    raise exc_type(_Error(message)) from cause
oracledb.exceptions.DatabaseError: DPY-4011: the database or network closed the connection

Searching this error, I found that it might be a firewall problem, but it’s deactivated in the V.M.

What else could I try?

EDIT: After setting the ENV variable here is the output(I hid some sensitive data)

2022-08-04 16:40:44.246 [socket: 3] Sending packet:
0000 : 01 10 00 00 01 00 00 00 |........|
0008 : 01 3E 01 2C 0C 01 20 00 |.>.,....|
0016 : FF FF 4F 98 00 00 00 01 |..O.....|
0024 : 00 C6 00 4A 00 00 00 00 |...J....|
0032 : 80 80 00 00 00 00 00 00 |........|
0040 : 00 00 00 00 00 00 00 00 |........|
0048 : 00 00 00 00 00 00 00 00 |........|
0056 : 00 00 00 00 20 00 00 00 |........|
0064 : FF FF 00 00 00 00 00 00 |........|
0072 : 00 01 28 44 45 53 43 52 |..(DESCR|
0080 : 49 50 54 49 4F 4E 3D 28 |IPTION=(|
0088 : 41 44 44 52 45 53 53 3D |ADDRESS=|
0096 : 28 50 52 4F 54 4F 43 4F |(PROTOCO|
0104 : 4C 3D 54 43 50 29 28 48 |L=TCP)(H|
0112 : 4F 53 54 3D 31 37 32 2E |OST=IPP.|
0120 : 32 30 2E 33 2E 32 35 34 |IP.I.IPP|
0128 : 29 28 50 4F 52 54 3D 31 |)(PORT=1|
0136 : 35 32 31 29 29 28 43 4F |521))(CO|
0144 : 4E 4E 45 43 54 5F 44 41 |NNECT_DA|
0152 : 54 41 3D 28 53 45 52 56 |TA=(SERV|
0160 : 49 43 45 5F 4E 41 4D 45 |ICE_NAME|
0168 : 3D 46 4F 52 54 45 53 45 |=SERVICE|
0176 : 43 29 28 53 45 52 56 45 |C)(SERVE|
0184 : 52 3D 64 65 64 69 63 61 |R=dedica|
0192 : 74 65 64 29 28 43 49 44 |ted)(CID|
0200 : 3D 28 50 52 4F 47 52 41 |=(PROGRA|
0208 : 4D 3D 2F 75 73 72 2F 62 |M=/usr/b|
0216 : 69 6E 2F 70 79 74 68 6F |in/pytho|
0224 : 6E 33 29 28 48 4F 53 54 |n3)(HOST|
0232 : 3D 61 72 74 68 75 72 2D |=arthur-|
0240 : 56 69 72 74 75 61 6C 2D |Virtual-|
0248 : 4D 61 63 68 69 6E 65 29 |Machine)|
0256 : 28 55 53 45 52 3D 61 72 |(USER=ar|
0264 : 74 68 75 72 29 29 29 29 |thur))))|

2022-08-04 16:40:44.391 [socket: 3] Receiving packet:
0000 : 00 08 00 00 0B 00 00 00 |........|

2022-08-04 16:40:44.391 [socket: 3] Sending packet:
0000 : 01 10 00 00 01 00 00 00 |........|
0008 : 01 3E 01 2C 0C 01 20 00 |.>.,....|
0016 : FF FF 4F 98 00 00 00 01 |..O.....|
0024 : 00 C6 00 4A 00 00 00 00 |...J....|
0032 : 80 80 00 00 00 00 00 00 |........|
0040 : 00 00 00 00 00 00 00 00 |........|
0048 : 00 00 00 00 00 00 00 00 |........|
0056 : 00 00 00 00 20 00 00 00 |........|
0064 : FF FF 00 00 00 00 00 00 |........|
0072 : 00 01 28 44 45 53 43 52 |..(DESCR|
0080 : 49 50 54 49 4F 4E 3D 28 |IPTION=(|
0088 : 41 44 44 52 45 53 53 3D |ADDRESS=|
0096 : 28 50 52 4F 54 4F 43 4F |(PROTOCO|
0104 : 4C 3D 54 43 50 29 28 48 |L=TCP)(H|
0112 : 4F 53 54 3D 31 37 32 2E |OST=IPP.|
0120 : 32 30 2E 33 2E 32 35 34 |IP.I.IPP|
0128 : 29 28 50 4F 52 54 3D 31 |)(PORT=1|
0136 : 35 32 31 29 29 28 43 4F |521))(CO|
0144 : 4E 4E 45 43 54 5F 44 41 |NNECT_DA|
0152 : 54 41 3D 28 53 45 52 56 |TA=(SERV|
0160 : 49 43 45 5F 4E 41 4D 45 |ICE_NAME|
0168 : 3D 46 4F 52 54 45 53 45 |=SERVICE|
0176 : 43 29 28 53 45 52 56 45 |C)(SERVE|
0184 : 52 3D 64 65 64 69 63 61 |R=dedica|
0192 : 74 65 64 29 28 43 49 44 |ted)(CID|
0200 : 3D 28 50 52 4F 47 52 41 |=(PROGRA|
0208 : 4D 3D 2F 75 73 72 2F 62 |M=/usr/b|
0216 : 69 6E 2F 70 79 74 68 6F |in/pytho|
0224 : 6E 33 29 28 48 4F 53 54 |n3)(HOST|
0232 : 3D 61 72 74 68 75 72 2D |=arthur-|
0240 : 56 69 72 74 75 61 6C 2D |Virtual-|
0248 : 4D 61 63 68 69 6E 65 29 |Machine)|
0256 : 28 55 53 45 52 3D 61 72 |(USER=ar|
0264 : 74 68 75 72 29 29 29 29 |thur))))|

2022-08-04 16:40:44.526 [socket: 3] Receiving packet:
0000 : 00 2D 00 00 02 00 00 00 |.-......|
0008 : 01 3E 0C 01 00 00 00 00 |.>......|
0016 : 01 00 00 00 00 2D C1 00 |.....-..|
0024 : 00 00 00 00 00 00 00 00 |........|
0032 : 00 00 20 00 00 00 FF FF |........|
0040 : 00 00 00 00 01          |.....   |

2022-08-04 16:40:44.526 [socket: 3] Sending packet:
0000 : 00 00 00 0B 0C 00 00 00 |........|
0008 : 01 00 02                |...     |

2022-08-04 16:40:44.526 [socket: 3] Sending packet:
0000 : 00 00 00 8F 06 00 00 00 |........|
0008 : 00 00 DE AD BE EF 00 85 |........|
0016 : 0B 20 02 00 00 04 00 00 |........|
0024 : 04 00 03 00 00 00 00 00 |........|
0032 : 04 00 05 0B 20 02 00 00 |........|
0040 : 08 00 01 00 00 10 1C 66 |.......f|
0048 : EC 28 EA 00 12 00 01 DE |.(......|
0056 : AD BE EF 00 03 00 00 00 |........|
0064 : 04 00 04 00 01 00 02 00 |........|
0072 : 03 00 01 00 03 00 00 00 |........|
0080 : 00 00 04 00 05 0B 20 02 |........|
0088 : 00 00 02 00 03 E0 E1 00 |........|
0096 : 02 00 06 FC FF 00 02 00 |........|
0104 : 02 00 00 00 00 00 04 00 |........|
0112 : 05 0B 20 02 00 00 01 00 |........|
0120 : 01 00 00 03 00 02 00 00 |........|
0128 : 00 00 00 04 00 05 0B 20 |........|
0136 : 02 00 00 01 00 01 00    |....... |

Asked By: Arthur Perin

||

Answers:

As proposed by Anthony Tuininga, disabling the oob (Out of band break) with:
disable_oob= True solved the issue. Thanks.

Answered By: Arthur Perin