Menu
Simba Technologies
Simba Technologies

SimbaEngine X SDK 10.1.3
Developing Drivers for Data Stores Without SQL

Testing On Windows

This section explains how to use Microsoft Access, Microsoft Excel, and the ODBCTest tool to test your custom ODBC driver.

Testing With Microsoft Access

Running your driver against Microsoft Access is a good test to prove basic functionality. Microsoft Access uses much of the ODBC API, including many of it's edge cases.

Note:

To get the widest test coverage of the ODBC API, test your driver under Microsoft Access by loading your data as linked tables.

To Test Your Custom ODBC Driver with Microsoft Access:

  1. Open Access and create a new Blank Database.
  2. Select External Tab -> More -> ODBC Database.
  3. In the Get External Data – ODBC Database dialog, select Link to the data source by creating a linked table.
  4. In the Select Data Source dialog, select the Machine Data Source table and choose your DSN. Click OK.
  5. In the Link Tables dialog, select the tables you want to link to. Click OK.
  6. In the Select Unique Record Identifier dialog, click OK without choosing any specific field.
  7. In the All Table panel, right click on a table name and click Open.

The data from the table appears in Microsoft Access.

Testing with Microsoft Excel

You can test your data source with Microsoft Excel by importing data using the Data Connection Wizard.

To Test Your Custom ODBC Driver with Microsoft Excel:

  1. Open Excel and create a new blank workbook.
  2. Select Data -> From Other Sources -> From Data Connection Wizard.
  3. In the Data Connection Wizard dialog, select ODBC DSN and click Next.
  4. In the ODBC data sources box, Select your DSN and click Next.
  5. In the Table box, select a table and click Next and then click Finish.
  6. In the Import Data dialog, select Table for how you want to view the data in the workbook and click OK.

The data from the table appears in your Excel workbook.

Testing with ODBCTest

ODBCTest is a test application provided by Microsoft as part of the Microsoft Data Access Components (MDAC) SDK and the Platform SDK. For more information about MDAC, see What is MDAC?.

This application allows you to manually execute any SQL query. You can also use it to directly call any method in the ODBC API. The full ODBC API is exposed through the ODBCTest menus, allowing you to walk through each step of an ODBC API call and viewing the results in real time.

The MDAC installation includes both ANSI and Unicode-enabled versions of ODBC Test, for both 32-bit and 64-bit systems. The versions are clearly marked in the Programs menu:

Note:

  • Select the correct version of MDAC for the bitness of your driver and ANSI or Unicode requirements.
  • On 64-bit Windows, ensure that your DSNs are configured correctly.

Running your driver under the debugger with ODBCTest configured as the launch application is an excellent way to test. You can set breakpoints in your DSII, and break into them as various ODBC calls trigger corresponding DSII calls. You can break at every DSII API call, and step through the execution of each of your DSII methods to track down problems with precision.

For more information on using Visual Studio to debug into your custom ODBC driver with ODBCTest, see the section Debug the Custom ODBC Driver in the 5 Day Guides at http://www.simba.com/resources/sdk/documentation/.

To Test Your Custom ODBC Driver with ODBCTest:

Before running this test, ensure you have already configured a DSN for your driver. For more information on creating a DSN in the Windows registry for your custom ODBC driver, see Update the Windows Registry in the 5 Day Guides at http://www.simba.com/resources/sdk/documentation/.

  1. Start the ODBCTest application, ensuring you run the correct version for ANSI or Unicode and 32-bit or 64-bit.
  2. To configure the application to use ODBC 3.52 menus, select Tools -> Options menu.
  3. Select the ODBC Menu Version -> ODBC 3.x.
  4. Create a connection to your driver using the appropriate DSN you already configured.
  5. Select Connect -> Full Connect.
  6. This option allocates the environment and connection handles, then opens the connection.

  7. Locate your DSN in the data source list.
  8. Select OK. A new window appears with the message “Successfully connected to DSN ‘<your driver name>”. The top half of the window allows you to enter SQL queries to be executed. The bottom half displays the results.

    Note:

    If you see the error “SQLDriverConnect returned: SQL_ERROR=-1”, use the following tips for troubleshooting. This error usually occurs because the Windows Driver Manager cannot find or load the requested driver’s DLL. Check the following:

    • Does your DSN exist in the registry both as a registry key in ODBC.INI and as a value in ODBC.INI\ODBC Data Sources?
    • Does your driver exist in the registry both as a registry key under ODBCINST.INI and as a value in ODBCINST.INI\ODBC Drivers?
    • Does your DSN have a Driver entry?
    • At the path specified in the DSN’s Driver entry, does the specified DLL exist?
  9. Enter a simple SQL query by selecting Statement -> SQLExecDirect. Select OK on the resulting dialog.
  10. From the Results menu, select GetDataAll.
  11. Review the results.
  12. Select Catalog -> SQLTables. Select OK on the resulting dialog.
  13. SQL Catalog functions work only if you have implemented the appropriate MetadataSources.

  14. Select Results -> GetDataAll.
  15. Review the results

 

Related Links

Debug the Custom ODBC Driver in the 5 Day Guides at http://www.simba.com/resources/sdk/documentation/

Update the Windows Registry in the 5 Day Guides at http://www.simba.com/resources/sdk/documentation/