SQLGetInstalledDrivers Function always searches /etc/odbcinst.ini file

Help
2013-09-25
2013-10-01
  • ameybarve15

    ameybarve15 - 2013-09-25

    Thanks in advance,

    I want to list all installed drivers on linux, I am using SQLGetInstalledDrivers Function for the same.

    Heres my code snippet:

    char buf[1024] = {0};
    char *drivers= buf;

    if (!SQLGetInstalledDrivers(buf, 1024, NULL))
    {
    printf("Error\n");
    return 1;
    }

    while (*drivers)
    {
    printf("%s\n", drivers);
    drivers += strlen(drivers) + 1;
    }

    I have set ODBCINI, ODBCINSTINI, and ODBCSYSINI
    export ODBCINI=/home/amey/odbc.ini
    export ODBCINSTINI=/home/amey/odbcinst.ini
    export ODBCSYSINI=/home/amey/odbcinst.ini

    All of these paths are accessible to me. But SQLGetInstalledDrivers gives me "error 12: Invalid install path."

    When I run my application with strace, it shows that manager successfully opens, reads, and writes from /home/amey/odbcinst.ini file and is also trying to open /etc/odbcinst.ini file, where it fails giving above error.

     
  • ameybarve15

    ameybarve15 - 2013-10-01

    I worked out the answer
    If there are multiple entries in odbcinst.ini file, then this api works.
    This is because, In SQLGetInstalledDrivers.c, iODBC DM checks for number of entries greater than 1
    If I install more than one driver, then this api correctly gives list of installed drivers.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks