1

I'm trying to configure an ODBC connection for an Oracle DB using unixODBC drivers. For that I followed this Oracle's guide.

First, I successfully installed the ODBC client and driver.

# dnf install unixODBC oracle-instantclient-sqlplus oracle-instantclient-odbc

Odbcinst shows the driver defaults correctly.

# odbcinst -j
unixODBC 2.3.7
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

Then, the guide suggests to configure ODBC with the odbc_update_ini.sh script.

# find / -name "odbc_update_ini.sh"
/usr/lib/oracle/21/client64/bin/odbc_update_ini.sh

For that, I should input the <ODBCDM_Home> as the first argument.

Usage: odbc_update_ini.sh <ODBCDM_Home> [<Install_Location> <Driver_Name> <DSN> <ODBCINI>]

It happens that this script cannot find the INI file.

# /usr/lib/oracle/21/client64/bin/odbc_update_ini.sh "/usr/local"
 *** INI file not found. Driver Manager not installed!

It seems there should be an $ODBCDM_Home environment variable set, but it does not exist, and Oracle's guide does not instruct us on how to set it.

# cat /usr/lib/oracle/21/client64/bin/odbc_update_ini.sh
(...)    
# Check whether Driver Manager is installed or not
if [ ! -f  $ODBCDM_HOME/etc/odbc.ini  -o  ! -f $ODBCDM_HOME/etc/odbcinst.ini ]
then
   echo " *** INI file not found. Driver Manager not installed!"
   exit
fi
(...)

I could not find meaninful information about this issue for now.

I'm at a loss now. Any idea on how to proceed?

1
  • Update ini file /etc/odbc.ini manually with your preferred editor. The syntax is simple, you don't need script odbc_update_ini.sh which does it for you. Sep 18, 2022 at 13:25

1 Answer 1

0

I found what I believe is the correct procedure to configure Oracle's ODBC while using odbc_update_ini.sh script.

After installing ODBC driver manager and Oracle's driver, by default we must start Oracle's script in the following manner.


/usr/lib/oracle/21/client64/bin/odbc_update_ini.sh "/" "/usr/lib/oracle/21/client64/lib" "oracle"

Arg1 - / = default directory for ODBC Driver Manager (root)

Arg2 - /usr/lib/oracle/21/client64/lib = default library directory

Arg3 - oracle = any name you wish for the Driver name (used in DSN config)


With that, the script configured /etc/odbcinst.ini with the correct driver, and /etc/odbc.ini with most configurations.

I believe this way is correct because the script adds a bunch of configurations that are not obvious at first.

$ cat /etc/odbc.ini
[oracle]
AggregateSQLType = FLOAT
Application Attributes = T
Attributes = W
BatchAutocommitMode = IfAllSuccessful
BindAsFLOAT = F
CacheBufferSize = 20
CloseCursor = F
DisableDPM = F
DisableMTS = T
DisableRULEHint = T
Driver = oracle
DSN = oracle
EXECSchemaOpt =
EXECSyntax = T
Failover = T
FailoverDelay = 10
FailoverRetryCount = 10
FetchBufferSize = 64000
ForceWCHAR = F
LobPrefetchSize = 8192
Lobs = T
Longs = T
MaxLargeData = 0
MaxTokenSize = 8192
MetadataIdDefault = F
QueryTimeout = T
ResultSets = T
ServerName = //[your_oracle_server]/[db_service]
SQLGetData extensions = F
SQLTranslateErrors = F
StatementCache = F
Translation DLL =
Translation Option = 0
UseOCIDescribeAny = F

And now I can access Oracle's DB.

$ isql oracle [USERNAME] [PASS]
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.