Link to home
Start Free TrialLog in
Avatar of Kapil Vyas
Kapil Vyas

asked on

How to debug ODBC driver in an Oracle Heterogeneous Services environment?

Oracle Heterogeneous Services is a feature of Oracle DB that allows the database to talk to non-Oracle DBs through their ODBC drivers.

It is fairly straightforward to debug an ODBC driver using ODBC client tools such as isql.

With isql - I can input the driver info at the initial command prompt. isql and similar tools accept the ODBC DSN name and directly loads the driver. Thus when I type: info sharedlibrary at the GDB command-prompt I see the ODBC shared library loaded that I am interested in debugging.

How can I do the same using sqlplus or other Oracle client tool?
However, with sqlplus there is no telling when the driver gets loaded.

How do I debug an ODBC driver ("dynamically loaded library") using Oracle Heterogeneous Services?
My ODBC driver works fine in isql environment.
I am interested in knowing how Oracle HS calls my driver to uncover issues in the ODBC driver and fix them.

Environment: Linux
Debugger: GDB
Oracle Heterogeneous Services: https://docs.oracle.com/cd/A81042_01/DOC/server.816/a76960/hs_conce.htm
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

sqlplus is a simple SQL interface to an Oracle database.

I'm not familiar with isql/gdb so I'm not sure what all they can do.

What are you specifically looking to uncover with your debugging?
A very good question.

I had to think on this a good bit + do some searching.

It appears GDB will ask you when a function doesn't exist...

Make breakpoint pending on future shared library load?

Open in new window


The shared/dynamic (dlopen) library must still be compiled with debug symbols + source must be available (for line stepping).

Otherwise, GDB appears to work well in this case.
I'm not sure that SQL*Plus uses shared libraries.  It may, but I've been using SQL*Plus in various versions and with various server O/Ses for over 25 years, and I've never encountered a reference to a shared library in SQL*Plus.
Can you describe the problem you hoped to solve by debugging an ODBC driver?  Maybe there is a different way to solve the problem in Oracle Heterogeneous Services or SQL*Plus.
isql is the Sybase (SQL Server may use it too) version of SQL*Plus

gdb is a debugger

SQL*Plus has always used shared libraries.  Running a Linux environment with 12.2.0.1 installed, I see SQL*Plus using these dynamic libraries:
Non-Oracle libraries
	linux-vdso.so.1
	libdl.so.2
	libm.so.6
	libpthread.so.0
	libnsl.so.1
	librt.so.1
	libaio.so.1
	libresolv.so.2
	libc.so.6
	libgcc_s.so.1

Oracle libraries
	libsqlplus.so
	libclntsh.so.12.1
	libclntshcore.so.12.1
	libmql1.so
	libipc1.so
	libnnz12.so
	libons.so

Open in new window

In a UNIX type environment, the ldd command is usually installed.  It will tell you all the dynamic libraries that an executable is loading and the path they resolve to (it will also say if they are unresolved).
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.