0

I am trying to connect to oracle using port 2484 using aws lambda in python using wallets. I have database.py which connects to oracle and added sqlnet.ora and tnsnames.ora in network/admin folders.

I am not sure whether my lambda is even looking into tnsnames.ora file. even though my tnsnames.ora file has protocol as TCPS but my lambda is taking protocol as TCP.

So I tried giving dsn string manually with tcps protocol

cx_Oracle.connect(self.username, self.password, dsn=self.tns)

where as

self.tns='(DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST='hostname')(PORT=2484))(CONNECT_DATA=(SERVICE_NAME='myservice')))

and getting error:

ncx_Oracle.DatabaseError: ORA-12547: TNS:lost contact

and I have tnsnames.ora and sqlnet.ora and wallet files in network/admin folder

Not sure where to look for

Christopher Jones
  • 9,449
  • 3
  • 24
  • 48
Vid
  • 1
  • 1
    Does this answer your question? [cx\_Oracle: How do I connect to Oracle when you use a Wallet?](https://stackoverflow.com/questions/63251612/cx-oracle-how-do-i-connect-to-oracle-when-you-use-a-wallet) – OldProgrammer Aug 03 '21 at 18:50
  • I am not sure my lambda is looking for sqlnet.ora file or tnsnames.ora rile at all.. I have tried above url but no luck – Vid Aug 03 '21 at 19:24
  • Have you seen this link? https://michaelellerbeck.com/2021/06/04/connecting-to-oracle-cx_oracle-with-aws-lambda-solved/ – pmdba Aug 03 '21 at 19:36
  • @pmdba yes, i have looked into it.. but it is for tcp connection and in the video he created tnsnames.ora file but I am not sure whether lambda is really using that tnsnames.ora file – Vid Aug 03 '21 at 19:56
  • If you have 19c (or later) Oracle client libraries you could try the 'Easy Connect' syntax similar to the examples in https://blogs.oracle.com/opal/how-connect-to-oracle-autonomous-cloud-databases That post uses wallets that don't contain DB credentials. Another reference on wallets that do have credentials is the cx_Oracle documentation https://cx-oracle.readthedocs.io/en/latest/user_guide/connection_handling.html#using-an-oracle-wallet-for-external-authentication – Christopher Jones Aug 03 '21 at 22:58

0 Answers0