When building an ODBC driver, Microsoft’s ODBC Test can be used to test the driver. This existing tool can reduce development time by eliminating having to write your own ODBC application for testing. On this blog, we will focus on how to bind named parameters through ODBC Test. If you are looking to do more testing with the tool, please refer to Testing your SimbaEngine SDK ODBC Driver with ODBC Test

  1. Open ODBC Test and Connect by clicking Conn > Full Connect Open-ODBC-Test
  2. From the list, select the DSN of your driver and click OK select-the-DSN

  3. Type the stored procedure, {call StoredProcedureName(?,?,?)}. stored-procedures Note that this stored procedure does not have a procedure return value. For this example, we will bind 3 parameters to a stored procedure by the name of “StoredProcedureName”. The first parameter is an input parameter with a string value of “Value1”, and a parameter name “ParamName1”. The second parameter is an input/output parameter with a sting value of “Value2” and a parameter name “ParamName2”. The third parameter is an output parameter with a string value of “Value3”, and a parameter name of “ParamName3”
  4. Prepare the query by clicking Stmt > SQLPrepareSQLPrepare

  5. Click OK SQL Prepare OK
  6. Bind Parameters one at a time. To bind the first parameter click Stmt > SQLBindParameter SQL Bind Parameter

  7. Set the ParameterNumber to 1, InputOutput Type to SQL_PARAM_INPUT=1 (2.0) and the ParameterValuePtr to Value1. Since this is a string type, we will use the default for the rest of the fields. Click OKSQLBindParameter
  8. To bind the second parameter click Stmt > SQLBindParameterSQLBindParameter - Second parameter


  9. Set the ParameterNumber to 2, InputOutput Type to SQL_PARAM_INPUT_OUTPUT=1 (2.0), the ParameterValuePtr to Value2 and the BufferLength to 100. Since this is a string type, we will use the default for the rest of the fields. Click OKSQLBindParameter
  10. To bind the third parameter click Stmt > SQLBindParameterSQLBindParameter


  11. Set the ParameterNumber to 3, InputOutput Type to SQL_PARAM_OUTPUT=1 (2.0), the ParameterValuePtr to Value3 and the BufferLength to 100. Since this is a string type, we will use the default for the rest of the fields. Click OKSQLBindParameter
  12. Click Attr > SQLGetStmtAttrSQLGetSTmtAttr

  13. Set Attribute to SQL_ATTR_IMP_PARAM_DESC=10013 (3.0) and click OKSQLGetSTmtAttr
  14. Click OKSet-description


  15. To set the name of parameter 1 click Desc > SQLSetDescFieldSetDescField
  16. Set the DescriptorHandle to Implicic IPD, RecNumber to 1, FieldIdentifier to SQL_DESC_NAME and the ValuePtr to ParamName1. Click OKSQL_DESC_NAME


  17. To set the name of parameter 2 click Desc > SQLSetDescFieldSetDescField
  18. Set the DescriptorHandle to Implicic IPD, RecNumber to 2, FieldIdentifier to SQL_DESC_NAME and the ValuePtr to ParamName2. Click OKSQL_DESC_NAME


  19. To set the name of parameter 3 click Desc > SQLSetDescFieldSetDescField
  20. Set the DescriptorHandle to Implicic IPD, RecNumber to 3, FieldIdentifier to SQL_DESC_NAME and the ValuePtr to ParamName3. Click OKSetDescField

  21. Execute the query by clicking Stmt > SQLExecuteSQLExecute
  22. Retrieve the results of the stored procedure by clicking Results > Get Data All
    Results of the stored procedure will be displayed.ODBC-test