I believe that an ODBC connection is made using an ODBC driver configured for a specific database engine (for example, Oracle, MSSQL, PSQL, etc.), and therefore a single query cannot contain two different database mechanisms as a query passes through a specific driver through the ODBC interface.
However, you can easily use two ODBC drivers in your code using a simple script in any programming language that has an ODBC library. For example, I use Python with pyodbc to initialize multiple connections and transfer data between MSSQL, MySQL, and PSQL databases. Here is an example of pseudo code:
import pyodbc psql_cursor = pyodbc.connect('<PSQL_ODBC_CONNECTION_STRING>').cursor() mysql_cursor = pyodbc.connect('<MYSQL_ODBC_CONNECTION_STRING>').cursor() result_set = mysql_cursor.execute('<SOME_QUERY>').fetchall() to_insert = <.... Some code to transform the returned data if needed ....> psql_cursor = psql_cursor.execute('insert into <some_table> VALUES (%s)' % to_insert)
I understand that Iβm taking you in a different direction, but I hope this helps anyway. It is nice to provide other examples if necessary.
source share