Chennai
Chennai
Singapore
Mumbai
Switzerland
+91 44 4091 2000 Mon - Fri 09:00 - 18:30 766/1, TEZ, Sakthi Towers 1, Anna salai, Chennai 600 002.
+6584181583 Mon - Fri 09:00 - 18:30 68 Circular Road, #02-01, 049422, Singapore.
+91 98848 35702 Mon - Fri 09:00 - 18:30 5, Powai Lake Heights, Mumbai 400 072
+41 (0)91 225 81 00 Mon - Fri 09:00 - 18:30 Equvera - ISV Techno SAGL, Via Ligornetto 6A, 6855 Stabio, Switzerland
Ceritified
ISO 9001:2018
The Best
#1 in India
#1 in Europe
#1 in Asian-pacific
Number #1
AUTOMATION SOLUTION PROVIDER
Talk to an Expert

USB HID to MSSQL: Write a lot of HID report items to the MS SQL Server database

USB HID TO MSSQL: WRITE A LOT OF HID REPORT ITEMS TO THE MS SQL SERVER DATABASE

If you need to write a lot of USB HID report items to an MSSQL database, it is not adequate to create a table with a separate column for each item because the values of items can be modified non at the same time. It produces a lot of empty columns generated in the database.

It will be more useful to create a table consisting of three columns.

CREATE TABLE [dbo].[usb_data] ( [REC_ID] [int] IDENTITY(1,1) NOT NULL, [ITEM_NAME] [nchar](25) NOT NULL, [ITEM_VALUE] [nchar](255) NULL, [TIMESTAMP] [datetime] NULL ) ON [PRIMARY]

ITEM_NAME – will be the name of the item;

ITEM_VALUE – will contain the string value of the item;

TIMESTAMP – will contain the date and time when the value was modified.

1. Create a new user in the database or give permissions to write and read data from the created table to an existing user.

2. Create a new configuration and select necessary USB HID devices from a list. If your USB device is not plugged yet, connect it temporarily before creating the configuration (fig. 1).

Fig. 1 Selecting a USB device

Fig. 1 Selecting a USB device

3. Select the following options:

Fig. 2 Selecting a logging mode

Fig. 2 Selecting a logging mode

4. Click OK. Data like that should appear in the main window of the program:

Fig. 3 Data

Fig. 3 Data

Every new value of USB HID report items appears on a new line here. Every line contains the additional “ITEM_NAME” and “DATE_TIME_STAMP” items with the item name and timestamp, respectively.

5. Select the data export plugin (fig. 4)

Fig. 5 Configuring the data export plugin. General.

Fig. 5 Configuring the data export plugin. General.

Fig. 5 Configuring the data export plugin. General.

Fig. 5 Configuring the data export plugin. General.

To set up a connection, you should create and configure the ODBC data source for connecting to your MSSQL database. Click the “Configure” button to do it. After you create the data source, click “Update” and select the data source from the list.

Fig. 6 Configuring the data export plugin. Connection.

Fig. 6 Configuring the data export plugin. Connection.

7. Binding (fig. 7) allows you to specify which data to which columns the program should add. You should specify the column name and “bind” the item to it from the main window of the program (the parser item). You should also specify the data type of the column.

Fig. 7 Configuring the data export plugin. Binding.

Fig. 7 Configuring the data export plugin. Binding.

8. Click “OK” to save the changes.

9. Check the status bar to make sure the data is being successfully processed (fig. 8).

Fig. 8 A message about data being successfully written

Fig. 8 A message about data being successfully written

RELATED ARTICLES: USB HID TO MSSQL: WRITE A LOT OF HID REPORT ITEMS TO THE MS SQL SERVER DATABASE