Partager via


ODBC DSN Management in the Next Release of Windows (code-named Windows “8” and Windows Server “8”)

We’re pleased to announce two new improvements for ODBC Data Source Name (DSN) Management that will be
available in the next release of Windows (code-named Windows “8” and Windows Server “8”).

 What’s New?

Improved User Interface in ODBC Data Source Administrator Panel (ODBCAD32)

In the past, you may have been confused by the ODBC DSN on 64-bit Windows (as discussed in the KB article).
In this improvement, we improved the user interface in ODBCAD32. In the dialog, a new column "Platform" is introduced to indicate which platform the DSN can be used:

 

The above screenshot shows that "DSN_to_Access" is a 32-bit only DSN, which can only be used in a 32-bit application. This is because the ODBC JET driver is only available on 32-bit platform. This also means that you have to use the 32-bit ODBC Data Source Administrator (C:\Windows\SysWow64\Odbcad32.exe on 64-bit windows) to configure and remove the DSN. Therefore, the “Remove” and “Configure” button have been disabled in the 64-bit ODBC Data Source  Administrator. On the contrary, the Platform column for “DSN_to_SQL” shows “32/64-bit”, which means that “DSN_to_SQL” can be used in both 32-bit and 64-bit applications.

 

Also, this gives you a more consistent user experience by providing a unified view of all 32-bit and 64-bit System DSN in a single dialog.

PowerShell Cmdlet Support

In the past, you may have configured an ODBC DSN with ODBCAD32, which is a useful GUI tools to manage a few DSN manually. However, it would be tedious to manage hundreds of DSN on a single machine, or manage a few DSN on hundreds of machines with ODBCAD32.
Hence, you usually had to deploy a DSN via registry directly, which may not be a very convenient approach. To improve the manageability of ODBC DSN (as well as a few other WDAC settings), we will release a few PowerShell cmdlets in the next release of Windows:

Cmdlet Noun

Cmdlet Verb

OdbcDsn

Get,  Add, Set, Remove

OdbcDriver

Get, Set

OdbcPerfCounter

Get,  Enable, Disable

WdacBidTrace

Get, Enable, Disable

 

This improvement allows you to manage an ODBC DSN programmatically. Also, you can manage DSN on remote machines with the PowerShell Remoting feature.

For example, you can add a 64-bit ODBC System DSN using the driver SQL Server Native Client 10.0 in the local system:

C:\PS> Import-Module Wdac

C:\PS> Add-OdbcDsn MyPayroll -DriverName "SQL Server Native Client 10.0" -DsnType System –Platform 64-bit –SetPropertyValue @("Server=MySqlServer","Trusted_Connection=Yes", "Database=Payroll") -PassThru

 

<Sample
Output>

Name       : MyPayroll

DsnType    : System

Platform   : 64-bit

DriverName : SQL Server Native Client 10.0

Attribute  : {Database, Server, Trusted_Connection}

 

When Can I Use These Improvements?

The above two improvements are already available in the Beta version of the next release of Windows (code-named Windows “8” and Windows Server “8”). Try out the Windows “8” Beta bits today!

 

How can I obtain the
documentation of the above PowerShell cmdlets?

You can run PowerShell with Administrative Privilege and then type “Update-Help Wdac”. Then, you can use “Get-Help” for each individual cmdlet, as normal.

 

Can I use the above PowerShell Cmdlets on downlevel Windows?

There is no plan to port the above cmdlets to Windows 7.

 

What’s the road map of the similar command-line tools OdbcConf?

The command-line tools OdbcConf is already deprecated and is superseded by the above PowerShell Cmdlet. The OdbcConf will be removed in a future version of Windows. Therefore, you are advised to plan the migration from OdbcConf to PowerShell Cmdlet.

 Pak-Ming Cheung

Microsoft Developer, WDAC team, Data Programmability

Comments

  • Anonymous
    June 26, 2012
    The comment has been removed

  • Anonymous
    July 11, 2013
    I want to create ODBC dsn using sql server or php code, is there any solutions for it ?

  • Anonymous
    August 13, 2013
    The comment has been removed