Help my Python script communicate from Linux to ODBC inside KVM/Windows
0
votes
1
answer
269
views
I'm using the module [pyodbc](https://github.com/mkleehammer/pyodbc) in a Python script to connect to the Intuit application QuickBooks over a network. To accomplish this I'm using an ODBC plugin/DLL called [QRemote](https://qodbc.com/using-quickbooks-remotely/) .
This is all very easy and straightforward on Windows using the Anaconda distribution of Python with
pydobc
. The connection string uses a DSN configured in [Microsoft's ODBC Data Source Admin](https://docs.microsoft.com/en-us/sql/odbc/admin/odbc-data-source-administrator?view=sql-server-ver15) together with the IP address for the remote machine I am connecting to:
import pyodbc
cn = pyodbc.connect(r'DSN=remote_clientname; IPAddress=192.168.0.50; Port=4500; RemoteDSN=local_clientname; openMode=F; OLE DB Services=-2;', autocommit=True)
The problem I'm having is I'm trying to run this same code executed on the Linux (Debian Buster) machine to communicate with this third-party DLL only supported on Windows. It was suggested I could accomplish this using KVM virtualization on Debian.
The Python connection on MS box to MS ODBC is very easy with PyODBC (A).
This is my first time with KVM and I don't have a clue about how to target the same MS ODBC DSN from Python script on Debian (B)
What I've done:
- Install the Microsoft driver for [Debian](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15)
- Completed a successful installation of KVM and installed Windows and the third-party plugin for ODBC.
- Installed [Microsoft ODBC driver for SQL Server Linux](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15)
**UPDATE:**
I have a [supporting question on SE](https://stackoverflow.com/a/67351905/343215) where PyODBC contributor GordThompson says, _"We cannot connect from one machine (e.g., Linux) to an ODBC DSN entry on another machine."_
*What do I need to have a script communicate with ODBC inside KVM/Windows?* Can I create an API out of the script at location (A) which can act as a proxy between script (B) and Microsoft's ODBC Data Source Admin?

Asked by xtian
(593 rep)
Apr 28, 2021, 12:04 AM
Last activity: Jun 7, 2021, 02:55 PM
Last activity: Jun 7, 2021, 02:55 PM