locked
using 32 bit OLE driver in build script RRS feed

  • Question

  • Hi

    In the middle of a fairly lengthy build script I need to update some database tables using a 32bit driver, there is no 64 bit driver available.

    The code works fine when I run it in an x86 powershell session. Is there a graceful way to execute the code in an x86 session from the middle of my build script? The code accesses database tables on a remote server, so I'm a bit worried about credential passing.

    The code that works in the x86 session looks something like this

    $ConnString = "Provider=vfpoledb;Data Source=\\RemoteServer\Files\database.dbf ;Collating Sequence=general;"
    $Conn = new-object System.Data.OleDb.OleDbConnection($connString) 
    $conn.open() 
    $cmd = new-object System.Data.OleDb.OleDbCommand($query,$Conn) 
    $da = new-object System.Data.OleDb.OleDbDataAdapter($cmd) 
    $dt = new-object System.Data.dataTable  
    $da.fill($dt) 

    Cheers

    Alex

    Friday, March 2, 2018 1:22 PM

All replies

  • No. You have to start a 32 bit version of PowerShell.  Consider getting  a native driver for your connection.

    DBF file can be opened by MSAccess ACE drivers which can be installed without MSAccess.

    https://stackoverflow.com/questions/15806511/c-sharp-connecting-to-dbf-file-using-microsoft-ace-oledb-12-0


    \_(ツ)_/

    Friday, March 2, 2018 3:35 PM
  • Hi

    It isn't an Access dbf, but I have a 32 bit drive that works.

    If the dbf file is held locally on the remote device then this method works.....

    $s = New-PSSession -ConfigurationName microsoft.powershell32 -ComputerName SERVER1
    Invoke-Command -Session $s -ScriptBlock {.........}

    However if the connection string refers to DBF's on a share on another server

    $ConnString = "Provider=vfpoledb;Data Source=\\Server2\Files\database.dbf ;Collating Sequence=general;"

    I get access denied.  Classic double hop problem I think.

    Monday, March 5, 2018 8:15 AM
  • All DBF files are alike.  They are all xBase files originally defined by dBase.

    The Access ACE drivers can load those file but the path is to the folder containing the file and the query references the filename as a table.

    The VF provider also wants the folder name and not the file name.  A VF database is a folder containing all of the DBF files.  Each DBF file is treated as a table.

    Yes.  YOU cannot remotely access a third system.


    \_(ツ)_/

    Monday, March 5, 2018 11:55 AM