How to perform a DSN-less pyodbc connection to Data Virtualization Server on Windows?
book
Article ID: KB0135560
calendar_today
Updated On:
Products
Versions
TIBCO Data Virtualization
All supported versions
Description
This article provides details to setup and configure a DSN-less pyodbc connection to Data Virtualization Server running on a Windows machine.
Environment
Windows Operating Systems
Resolution
Pre-requisite:
Install the latest Python version and any Python client tool like Python IDLE: https://www.python.org/downloads/
Install TDV 8.8 ODBC driver or any other driver as per the requirement.
Follow the below steps - (1) Open Python IDLE and write the script for a DSN-less pyODBC connection. Here is a sample script that performs basic authentication -
import sys,pyodbc conn_string=""" Driver={TIBCO(R) Data Virtualization 8.8};Server=10.888.88.88;Port=9411;Domain= composite;user=admin;password=password;dataSource=test""" conn = pyodbc.connect(conn_string) curr=conn.cursor() curr.execute(""" SELECT OrderID, ProductID, CompanyName FROM ViewOrder """) rows = curr.fetchall() for row in rows: print(row) conn.commit() curr.close() conn.close()
Note:
The above connection string is with basic authentication using the DV admin user. For the complete list of DV ODBC driver-supported connection string properties, refer to the DV Client Interface guide
The Driver field should contain the name of the DV ODBC driver. An example is this case with the 8.8.0 GA release driver the name is {TIBCO(R) Data Virtualization 8.8}.
The syntax for conn_string=""" Driver={DV_driver_name};Server=[DV_Server_IPadrress/servername];Port=[TDV base port+1];Domain=[DV domain name];user=[DV user];password=[DV users password];dataSource=[DV published data source]"""
(2) In the Python IDLE > Run > Run Module Screenshot of the output for reference:
Issue/Introduction
How to perform a DSN-less pyodbc connection to Data Virtualization Server on Windows?