ODBC vs JDBC performance ODBC vs JDBC performance database database

ODBC vs JDBC performance


Statements presented by mathworks website, these appear to be generally applicable.

Deciding Between ODBC and JDBC Drivers

Use native ODBC for:

  • Fastest performance for data imports and exports
  • Memory-intensive data imports and exports

Use JDBC for:

  • Platform independence allowing you to work with any operating system (including Mac and Linux®), driver version, or bitness (32-bit or 64-bit)
  • Using Database Toolbox functions not supported by the native ODBC interface (such as runstoredprocedure)
  • Working with complex or long data types (e.g., LONG, BLOB, text, etc.)

Tip:

  • On Windows systems that support both ODBC and JDBC drivers, pure JDBC drivers and the native ODBC interface provide better connectivity and performance than the JDBC/ODBC bridge.


The following points may help:

Multithread: - JDBC is multi-threaded - ODBC is not multi-threaded (at least not thread safe)

Flexibility: - ODBC is a windows-specific technology - JDBC is specific to Java, and is therefore supported on whatever OS supports Java

Power : you can do everything with JDBC that you can do with ODBC, on any platform.

Language: - ODBC is procedural and language independent - JDBC is object oriented and language dependent (specific to java).

Heavy load: - JDBC is faster - ODBC is slower

ODBC limitation: it is a relational API and can only work with data types that can be expressed in rectangular or two-dimensional format. (it will not work with data types like Oracle’s spatial data type)

API: JDBC API is a natural Java Interface and is built on ODBC, and therefore JDBC retains some of the basic feature of ODBC


Are you sure you are comparing drivers and not whole environments?

I see that for ODBC you use C program. Try ODBC driver with the same program you use to test JDBC but now use JDBC-ODBC bridge (I often use Jython for such things). Of course bridge adds some additional time. Also remember that JVM uses JIT -- the longer your application works the better performance.

Performance is important but for me much more important is stability of drivers. I had some problems with various ODBC drivers and now I prefer JDBC drivers. But even ODBC drivers can work with high-load multi-threaded servers for many months.