1 Reply Latest reply: May 6, 2011 7:29 PM by Fernando Suzuki RSS

    Using a Config file for ODBC Connect statment values

    Ken Atanacio

      I'd like to read in a standard text configs.csv config file to load values for the ODBC Connect Statement.

      Example:

      config.csv:

      conf_value, conf_field
      odbc_name,test
      user_id,user
      password,password

      script:

      ODBC CONNECT TO confvalue1 (UserId isconfvalue2, Password is confvalue3);

      Is this possible? When I try adding variables to the ODBC CONNECT statement I am getting syntax errors.

      Thanks

        • Using a Config file for ODBC Connect statment values
          Fernando Suzuki

          Hi PMCanada, yes it is possible!

           

          here is a sample:

          _______________________________________________________________________

           

          tmp:

          LOAD * INLINE [

              conf_field, conf_value

              ODBCName, YourODBCName

              UserID, YourUserID

              Password, YourPassword

          ];     //replace this inline load with your load from the csv file

           

          let vODBCName = lookup('conf_value', 'conf_field', 'ODBCName', 'tmp');

          let vUserID = lookup('conf_value', 'conf_field', 'UserID', 'tmp');

          let vPassword = lookup('conf_value', 'conf_field', 'Password', 'tmp');

          drop table tmp;

           

          ODBC CONNECT TO $(vODBCName) (UserId is $(vUserID), Password is $(vPassword));

          _______________________________________________________________________

           

          Hope this helps you.

          Regards,

          Fernando