none
Add-OdbcDsn not finding installed driver RRS feed

  • Question

  • Hello,

    When I execute the following command, I get a few error messages stating that it could not find the driver.

    Add-OdbcDsn -Name "[ODBCNAME]" -DriverName "MySQL ODBC 5.1 Driver" -DsnType "User"

    However, if I run:

    Get-OdbcDriver -Name MySQL*

    it returns 1 result with the name "MySQL ODBC 5.1 Driver", same as I entered in the command above.  I also tried saving the Get-OdbcDriver output to a variable, and referencing the variable in the Add-OdbcDsn command in case there is an invisible character or something else going on in the driver name, but I received the same result again.  I'm wondering if powershell doesn't like the "." in the driver name, as I get the same error if I try to run the following (without the wildcard):

    Get-OdbcDriver -Name "MySQL ODBC 5.1 Driver"

    I am also able to create the DSN manually through the GUI, so the driver is definitely there, Powershell (or something I am doing wrong within it) is having an issue.

    Please let me know if you have any suggestions I can try.

    Thanks in advance,

    Andrew

    • Moved by Bill_Stewart Friday, July 27, 2018 6:44 PM Abandoned
    Friday, May 4, 2018 7:53 PM

All replies

  • A driver is a provider.  A DSN is a definition of a named driver configuration.

    Get-OdbcDsn -Name "[ODBCNAME]"


    \_(ツ)_/

    Friday, May 4, 2018 7:59 PM
  • Can you expand on that a bit?

    The command I am using doesn't have an issue creating a DSN that uses a different driver.  It's only with this driver that there's an issue, so I'm wondering if the "." is causing an issue.

    I am still a bit new to ODBC stuff, so I apologize if I am referring to some things incorrectly.

    Thanks,

    Andrew

    Monday, May 7, 2018 6:57 PM
  • You are not creating a driver.  You are creating a Dsn.

    \_(ツ)_/

    Monday, May 7, 2018 8:22 PM
  • That's correct, and I understand that part.  The DSN needs to reference a driver though, (hence the DriverName parameter, which I believe is required), but Powershell isn't able to find the driver within the Add-OdbcDsn cmdlet.  As I mentioned above, it's able to find the driver using a wildcard with the Get-OdbcDriver cmdlet.
    Monday, May 7, 2018 9:29 PM
  • I would post in the MySQL forum as this may be an issue with that provider only.

    Be sure you are using the latest MySQL ODBC driver.


    \_(ツ)_/

    Monday, May 7, 2018 9:37 PM
  • I just ran you code with MySQL 5.1.13 and had no issues:

     Add-OdbcDsn -Name MySqlTest -DriverName 'MySQL ODBC 5.1 Driver' -DsnType User
    
    PS D:\scripts> Get-OdbcDsn MySqlTest
    
    
    Name       : MySqlTest
    DsnType    : User
    Platform   : 64-bit
    DriverName : MySQL ODBC 5.1 Driver
    Attribute  : {PORT}
    
    
    
    PS D:\scripts>
    Be sure you I stalled the correct version(x86 64 bit)


    \_(ツ)_/


    • Edited by jrv Monday, May 7, 2018 9:43 PM
    Monday, May 7, 2018 9:42 PM