none
Resolution of following Error: IM010: [Microsoft][ODBC Driver Manager] Data source name too long

    Question

  • Hi SQL Server Team,

    In order to add a data source by using ODBC Administrator, programmatically i am using SQLConfigDataSource. Thus calling  SQLConfigDataSource with the fOption set to either ODBC_ADD_DSN for creating a new DSN.

    Following is the stattement specified in the source code. where type_of_driver = "Microsoft Access Driver (*.mdb)"; and  parameters contains the data source source credentials information such as DSN, UID, PSW, FIL, Description, DataDirectory,DEFAULTDIR and DBQ all separated by "\0".

                    rc = SQLConfigDataSource(NULL, ODBC_ADD_DSN, type_of_driver, parameters);

    after execution of below mentioned command an error is encountered i.e -1 is returned if the DataDirectory path exceeds certain nested directories link. for eg. the file path specified below.

    C:\My Documents\Clients Current\AHW Netcare Benefits\Deliverables\1-5 Results Chain - system Level\Alberta Netcare\Benefits Logic System Level V01.rcm

    Creating a datasource with the file name i.e Benefits Logic System Level V01 every time.
    rc = :: SQLConnect(hDbc, (unsigned char *)szSource, SQL_NTS, (unsigned char *)szUserName, SQL_NTS, (unsigned char *)szPassword, SQL_NTS);

    Also following error message was encountered during execution of SQLConnect command.

    /*szErrorMsg = 0x0012e834 "[Microsoft][ODBC Microsoft Access Driver]General error Not enough information to connect to this DSN with SQLConnect.   Use SQLDriverConnect."*/

    Thus followed the instruction smentioned in the error message an dtried using SQL DriverConnect() in the following manner.
     rc = :: SQLDriverConnect(hDbc, NULL,(SQLCHAR *)"DSN=RCM",SQL_NTS,outstr, sizeof(outstr),
    &outstrlen,SQL_DRIVER_NOPROMPT);

    Still an error is encountered but this time it returns a RETCODE of 100 whrease earlier it had returned -1.

    Inform the procedure to be followed using SQLConnect when DataDirectory path is too long.

    An early reply will be appreciated.

    Cheers & Regards,
    Saresh


    Tuesday, February 26, 2008 11:52 AM

Answers

  • You don't have to create a registry DSN to connect to a data source, you can specify all your connection options directly in the connection string.  ODBC return code 100 is "SUCCESS_WITH_INFO", so it did not fail, it just had information for you when it finished, so your driver connect connected.

     

    Thanks,

     

    John

    Tuesday, February 26, 2008 6:32 PM