How to edit the path in odbcinst -j

It looks like the "default" path is not set correctly.
I'm pretty sure you're already doing it as it is mentioned in different places, but I want to remind that you should set the right environmental variables as described in the following links:
http://www.raosoft.com/ezsurvey/help/2007/odbc_in_unix.html http://gemfirexd.docs.pivotal.io/1.3.0/userguide/developers_guide/topics/odbc/install_config_odbc.html
It means that in your case, you could add a couple of lines to your .bashrc or .bash_profile or similar so that the program points to the right locations every time you would open your shell.
The lines to add would be then:

export ODBCINI=/etc/odbc.ini
export ODBCSYSINI=/etc

Looking indeed at the source code of unixODBC-2.2.14-p2 package, when invoking odbcinst -j it will go through the following branch in the code

case 'j':
    PrintConfigInfo();
    exit(0);

and PrintConfigInfo() will do the job of printing a bunch of info, specifically what you see

void PrintConfigInfo()
{
    char szFileName[ODBC_FILENAME_MAX+1];
        char b1[ 256 ], b2[ 256 ];

    printf( "unixODBC " VERSION "\n" );

    *szFileName = '\0';
    sprintf( szFileName, "%s/odbcinst.ini", odbcinst_system_file_path( b1 ), odbcinst_system_file_name( b2 ));
    printf( "DRIVERS............: %s\n", szFileName );

    *szFileName = '\0';
    _odbcinst_SystemINI( szFileName, FALSE );
    printf( "SYSTEM DATA SOURCES: %s\n", szFileName );

    *szFileName = '\0';
    _odbcinst_FileINI( szFileName );
    printf( "FILE DATA SOURCES..: %s\n", szFileName );

    *szFileName = '\0';
    _odbcinst_UserINI( szFileName, FALSE );
    printf( "USER DATA SOURCES..: %s\n", szFileName );

    printf( "SQLULEN Size.......: %d\n", sizeof( SQLULEN ));
    printf( "SQLLEN Size........: %d\n", sizeof( SQLLEN ));
    printf( "SQLSETPOSIROW Size.: %d\n", sizeof( SQLSETPOSIROW ));
}  

Now let's examine one of the print statements to understand where it gets the path from, let's take for example the line

printf( "SYSTEM DATA SOURCES: %s\n", szFileName );

where szFileName is set by the following call:

_odbcinst_SystemINI( szFileName, FALSE );  

which is defined in the file odbcinst/_odbcinst_SystemINI.c:

BOOL _odbcinst_SystemINI( char *pszFileName, BOOL bVerify )
{
        FILE                    *hFile;
        char                    b1[ 256 ];

    sprintf( pszFileName, "%s/odbc.ini", odbcinst_system_file_path( b1 ));

        if ( bVerify )
        {
        /* try opening for read */
                hFile = uo_fopen( pszFileName, "r" );
                if ( hFile )
                        uo_fclose( hFile );
                else
        {
            /* does not exist so try creating it */
            hFile = uo_fopen( pszFileName, "w" );
            if ( hFile )
                uo_fclose( hFile );
            else
                return FALSE;
        }
        }

        return TRUE;
}

where it sets the string to be printed in the following line

sprintf( pszFileName, "%s/odbc.ini", odbcinst_system_file_path( b1 ));

To understand how odbcinst_system_file_path( b1 ) sets this path we look at the source and one finds

  char *odbcinst_system_file_path( char *buffer )
{
    char *path;
    static char save_path[ 512 ];
    static int saved = 0;

    if ( saved ) {
            return save_path;
    }

    if (( path = getenv( "ODBCSYSINI" ))) {
                strcpy( buffer, path );
        strcpy( save_path, buffer );
        saved = 1;
        return buffer;
        }
#ifdef SYSTEM_FILE_PATH
    else {
        strcpy( save_path, SYSTEM_FILE_PATH );
        saved = 1;
        return SYSTEM_FILE_PATH;
        }
#else
    else {
        strcpy( save_path, "/etc" );
        saved = 1;
        return "/etc";
        }
#endif
}

which as you can see read the environmental variable through getenv( "ODBCSYSINI" ). Similar for others. Now, the original code has another branch but ends up doing a similar thing using customized functions.


Try this if you haven't reset your odbcinst.ini

cnx = pyodbc.connect(server=servername, database = DBname, user=Username,
                           tds_version='7.3',password=Password,port=portno,
                           driver='/usr/local/lib/libtdsodbc.so')

I believe the root of the error you are getting is because your .odbc.ini's DRIVER definition is not pointing to your odbcinst.ini's driver name.

It should be something like this:

cat odbc.ini
[SQLServer]
Description     = ODBC for MSSQL
Driver          = DRIVER_ISSUE
Servername      = 
Database        = 
UID             = 
Port            = 1433

cat /etc/odbcinst.ini
[DRIVER_ISSUE]
Description     = ODBC for MSSQL
Driver          = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
Setup           = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
UsageCount      = 1
FileUsage       = 1

On top of this, I believe your driver(libodbcmyS.so) is NOT correct for SQL-Server. (Note: this answer depends on the symbolic link you've already added.)