Christopher Jones
Christopher Jones

Reputation: 10661

Error DPY-3010 when connecting python-oracledb to Oracle DB 11.2

If I try to connect to Oracle Database 11.2 using python-oracledb's default 'Thin' mode I get the error:

DPY-3010: connections to this database server version are not supported by python-oracledb in thin mode

How can I connect to this old version of Oracle Database?

Upvotes: 2

Views: 15866

Answers (1)

Christopher Jones
Christopher Jones

Reputation: 10661

Python-oracledb's default Thin mode can connect to Oracle Database 12.1 or later. If you want to connect to Oracle Database 11.2 you need to enable Thick mode by calling oracledb.init_oracle_client() in your code. See the user documentation Enabling python-oracledb Thick mode:

import os
import oracledb

ld = None  # On Linux, pass None
if platform.system() == 'Darwin':
    ld = str(os.environ.get('HOME'))+'/Downloads/instantclient_23_3'
elif platform.system() == 'Windows':
    ld = r'C:\oracle\instantclient_19_26'
oracledb.init_oracle_client(lib_dir=ld)

c = oracledb.connect(user="yourusername", password=whatever, dsn="thedbhost:thedbport/thedbservicename")

Oracle DB 11.2 is very old. There is a newer, free release of Oracle Database available for Linux and Windows: Oracle Database 23c Free.

Upvotes: 7

Related Questions