Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

32 bit vs 64 bit odbc connection problems

$
0
0

Good morning,

I am trying to connect a powershell script that worked fine on a 32 bit system, but now will not work on a 64 bit system.  This script connects to a odbc connection and connects to a remedy ticket system and pulls information to move over to my Outlook calendar.

The error am getting is:

Exception calling "Open" with "0" argument(s): "ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application"
At C:\Users\Public\Documents\RemedyCRQ.ps1:25 char:17
+ $connection.Open <<<< ()
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

***********************************************************************************

The code that is running this is below:

$script:showWindowAsync = Add-Type –memberDefinition @”
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
“@ -name “Win32ShowWindowAsync” -namespace Win32Functions –passThru

$null = $showWindowAsync::ShowWindowAsync((Get-Process –id $pid).MainWindowHandle, 2)


$connection = New-Object System.Data.Odbc.OdbcConnection
$command = New-Object System.Data.Odbc.OdbcCommand
$command.Connection = $connection

$remedyTickets = @()

$connectionString = "DSN=remedy"

$connection.ConnectionString = $connectionString

$connection.Open()

I would appreciate it if someone had some insight to offer.  I've looked around and have created the ODBC connection on the 32 bit odbc version c:\windows\sysWOW64\odbcad32.exe.  Doesn't seem to have changed anything.  Ive created it both as a user and system DSN.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>