HARISH SOMSOLE
HARISH SOMSOLE

Reputation: 1

Trying to connect oracle db to the django application using wallet.zip file

I'm configuring my Oracle database to the django application using wallet.zip file in the following way. Note: This wallet.zip file contains tnsnames.ora file.

In settings.py file:

DATABASES = {    

    "oracledb": {

        "ENGINE": "django.db.backends.oracle",

         "NAME": "dummyemployee",

         "USER": "dummyuser123",

         "PASSWORD": "dummypass123",
         "OPTIONS": {

            "wallet_location": "C:\\Users\\Administrator\\Desktop\\Wallet_Location"
         }
     }
}

But when I try to execute the API.

It's returning the following error: "wallet_location is an invalid keyword argument for this function"

Upvotes: 0

Views: 224

Answers (1)

Christopher Jones
Christopher Jones

Reputation: 10691

Make sure you have the latest Django 5 and latest python-oracledb versions:

python3 -m pip install Django oracledb --upgrade

Then unzip the wallet zip file - it must be unzipped. In the example below, my directory /Users/cjones/CJMTLS contains the files:

  -rw-r--r--@  1 cjones  staff   3029 22 Apr 00:07 README
  -rw-r--r--@  1 cjones  staff   5349 22 Apr 00:07 cwallet.sso
  -rw-r--r--@  1 cjones  staff   5304 22 Apr 00:07 ewallet.p12
  -rw-r--r--@  1 cjones  staff   5710 22 Apr 00:07 ewallet.pem
  -rw-r--r--@  1 cjones  staff   3192 22 Apr 00:07 keystore.jks
  -rw-r--r--@  1 cjones  staff    691 22 Apr 00:07 ojdbc.properties
  -rw-r--r--@  1 cjones  staff    114 22 Apr 00:07 sqlnet.ora
  -rw-r--r--@  1 cjones  staff    768 22 Apr 00:07 tnsnames.ora
  -rw-r--r--@  1 cjones  staff   2056 22 Apr 00:07 truststore.jks

Then your Django settings will be like this:

DATABASES = {
  'default': {
    'ENGINE': 'django.db.backends.oracle',
    'NAME': 'cjmtls_high',
    'USER': 'admin',
    'PASSWORD': 'xxxxxxxxxxxx',
    'OPTIONS': {
        "config_dir": "/Users/cjones/CJMTLS",
        "wallet_location": "/Users/cjones/CJMTLS",
        "wallet_password": "xxxxxxxxxx"
    }
  }
}

Note that you have to supply the wallet password to open the PEM file.

For general background, see the doc Connecting to Oracle Cloud Autonomous Databases.

Upvotes: 1

Related Questions