Forum posts for msdtc.exe

Is it possible to programmatically get the server details from an ODBC DSN?

I'm working on some issues with psqlODBC's XA/MSDTC transaction handling and I find myself needing to obtain the server connection details (hostname, port, etc) from any user-supplied dsn programmatically without having psqlODBC invoked via the Driver Manager to do so.

Just parsed key/value string pairs will do; the problem is resolving user/system/file DSNs to get the underlying connection info.

The underlying issue I'm trying to solve is that a 32-bit application using MSDTC on a 64-bit system will supply a DSN that works for the 32-bit PostgreSQL driver. The 64-bit PostgreSQL drivers have different names - PostgresSQL ANSI vs PostgreSQL ANSI(x64) and similar for the Unicode drivers. So a DSN that works for a 32-bit app won't work for 64-bit apps ... like msdtc.exe. So I need a way to get the connection parameters the 32-bit app used and feed them into the 64-bit ODBC driver (or direct to libpq).

In the case of a DSN-less connection string like:

DRIVER={{PostgreSQL ANSI}};SERVER=127.0.0.1;PORT=5432;DATABASE=SOMEDB;UID=Administrator;PWD=;CA=disable'


I could just parse it to get the relevant info, but that won't work for file, system, or user DSNs where the XA transaction co-ordinator used by MSDTC only gets whatever the original user app passed to the ODBC layer - like:

DSN=SomeUserOrSystemDSNName


or

FILEDSN=C:SomeFileDSN.dsn


and wrapped in that DSN is a DRIVER={{{PostgreSQL ANSI}}.

I've taken a look at the ODBC API docs and I don't see anything that seems to expose a way to load any DSN string, resolve file/system/user DSNs and get a parameter hash/map. OTOH, there's a lot of documentation out there, and some of the sections and function names aren't what I'd call predictable.

So - please tell me I'm missing something obvious, and there's a way to just:

GetDSNProperty('FILEDSN=C:SomeFileDSN.dsn', 'SERVER');


.. rather than writing hacky code to manually look up each DSN type.

View complete forum thread with replies

Other posts related to msdtc.exe

See Related Forum Messages: Follow the Links Below to View Complete Thread

When machine-wide tracing is enabled, where does ODBC store logs for NETWORKSERVICE?
msdtc missing on Windows Embbeded 8 Standars WE8S
MSDTC (Distributed Transaction Coordinator) Service Stops Unexpectedly
MSDTC (Distributed Transaction Coordinator) Stops working. Error code -1073737669
Chef Guard for Windows Firewall with Custom GUID
MSDTC.exe listening on port 5357 but DCOM port range restricted to 5000-5020
How should MSDTC be configured to use SSL with Websphere MQ when coordinating a distributed …
When running odbcad32 as Administrator, machine-wide tracing still not available
Is it possible to programmatically get the server details from an ODBC DSN?

What is the carbon footprint of your coffee?

Is it low? Is it high? Can this things really kill the planet Earth? Maybe the answer will surprise you. Maybe not.