Author Archives: Taufiq

How to Connect to MS Access Database using JDBC:ODBC Connection

  1. Depending on whether your Java application is 32-bit or 64-bit, choose the correct ODBC Data Source Administrator (64bit or 32 bit) to create the Data Source Name. Otherwise, the connection cannot be established.
      • If your Java application is 64-bit then use ODBC Data Source Administrator 64-bit
      • If your Java application is 32-bit then use ODBC Data Source Administrator 32-bit
  2. Open ODBC Data Source Administrator (make sure the correct version is used).
  3. Select “System DSN” tab. Click “Add”.
    JDBC-01
  4. In this example, we are connecting to MS Access database, in “Create New Data Source”, select “Microsoft Access Driver (*.mdb, *.accdb)” in the list. Click “Finish”.
    JDBC-02
  5. In “ODBC Microsoft Access Setup”, enter any “Data Source Name”. This name will be used in DBeaver later. So remember it. After that click “Select…” button.
    JDBC-03
  6. Now you have to locate your MS Access file. In this example we use “SMSEngine5.mdb”. Click “OK”.
    JDBC-04
  7. Example of the Data Source Name created.
    JDBC-05
  8. Open DBeaver (or any other database management tool). Click on “Database -> New Database Connection”
    JDBC-06
  9. In “Connect to database”, select “ODBC” in the list. Click “Next”
    JDBC-07
  10. Insert “Database/Schema” name the same like you created earlier in ODBC Data Source Administrator. Click “Test Connection” to test the ODBC connection.
    JDBC-08
  11. If everything is setup right, you will get the below message. Click “Finish”
    JDBC-09

How to Solve “ERROR [HYT00][Microsoft][ODBC SQL Server Driver]Query timeout expired”

PROBLEM: ERROR [HYT00][Microsoft][ODBC SQL Server Driver]Query timeout expired

POSSIBLE CAUSE: Database too large, too many records in tables

SOLUTION: Create an index for “outbox” table:-

  1. Stop the SMS Engine service of MobiGATE
  2. Using SQL Management Studio, go to “indexes” of “dbo.outbox”, right-clickm select “New Index…”
  3. For “index name”, enter “To solve query timeout”
  4. Select “Nonclustered”
  5. Click “Add” to add 2 columns “datetime_queued” and “sent_status” (refer to red boxes below):
  6. Click “OK” button and a new index will be created:
  7. Start the SMS Engine service of MobiGATE
  8. Observe in log if this eror message still appear “ERROR [HYT00][Microsoft][ODBC SQL Server Driver]Query timeout expired
  9. If it appears again, please fill-in the table below:
    QUESTIONS ANSWERS (provide screen shot if available) REMARK
    Date of index created (as shown above)
    Take a screen capture of the SQL Management Studio showing:

    1. the new index
    2. the columns in the new index
    Date of the error message “ERROR [HYT00][Microsoft][ODBC SQL Server Driver]Query timeout expired” first appear
    Total number of records in “outbox” table when the error first appears
    Please send us:

    • the log file of the date when the error appear
    • “config.xml” file

How to Write a SQL Statement that Sums All Records of Different Items in Each Group as “Total Balance”

Problem: In “Stock Card” table, it records the stock movement, “In” and “Out”  of each item (ITEM ID).  There are different items that belongs to same group (GROUP).  And there are many groups (GROUP).

 

STOCK CARD TABLE
GROUP ITEM ID IN OUT
EKONOR EKONOR-1 20
EKONOR EKONOR-1 10
EKONOR EKONOR-2 40
EKONOR EKONOR-2 10
EKONOR EKONOR-2 20
SAGA SAGA-1 10
SAGA SAGA-1 5
SAGA SAGA-1 5
SAGA SAGA-2 10
SAGA SAGA-2 10
SAGA SAGA-2 20

How to get the sum (TOTAL BALANCE) of each group as below?

GROUP TOTAL RECORDS TOTAL BALANCE
EKONOR 5 20
SAGA 6 10

 

Solution: using this SQL statement

SELECT `Group`,
(SELECT COUNT(Stock_Description.`Group`) FROM Stock_Description WHERE Stock_Description.`Group` = sd.`Group`) As `TOTAL RECORDS`,
(SELECT SUM(COALESCE(a.`IN`,0) – COALESCE(a.`OUT`,0)) FROM Stock_Card a WHERE a.Item_ID LIKE CONCAT(sd.`Group, ‘%’) AND a.Balance IS NOT NULL) AS `TOTAL BALANCE` FROM Stock_Description sd GROUP BY `Group`;

 

SELECT SUM(COALESCE(a.`IN`,0) – COALESCE(a.`OUT`,0)) FROM Stock_Card a WHERE a.Item_ID LIKE CONCAT(sd.`Group`, ‘%’) AND a.Balance IS NOT NULL) AS Total_Balance

the above SQL statement will display  a “TOTAL BALANCE” of each “GROUP” by:-

  • summing all “In” records of “EKONOR” minus the sum of all “Out” of EKONOR”
    • (20 + 40) – (10 + 10 + 20)
    • = 20
  • summing all “In” records of “SAGA” minus the sum of all “Out” of  “SAGA”
    • (10 + 5 + 10 + 10) – (5 + 20)
    • = 10

 

SELECT COUNT(Stock_Description.`Group`) FROM Stock_Description WHERE Stock_Description.`Group` = sd.`Group`) As `TOTAL RECORDS`

the above SQL statement will display  a “TOTAL RECORDS” of each “GROUP” by:-

  • summing all records in “EKONOR” group
  • summing all records in “SAGA” group

Source:-

The Location of My.Settings Used by VB.Net Application

Determine whether the application saves the user settings on exit.

The SaveMySettingsOnExit property allows the user to change how the application saves settings, at run time. You can explicitly save setting changes by using the Save method of the My.Settings object.

The changes to this property are not persisted when the application closes. To change the SaveMySettingsOnExit property permanently, you must change the setting in the Project Designer:

To change the setting in the Project Designer
1. Have a project selected in Solution Explorer. Click Properties on the Project menu.
2. Click the Application tab.
3. Select Save My.Settings on Shutdown.

There are two types of application settings, based on scope:

  • Application-scoped settings can be used for information such as a URL for a web service or a database connection string. These values are associated with the application. Therefore, users cannot change them at run time.
  • User-scoped settings can be used for information such as persisting the last position of a form or a font preference. Users can change these values at run time.

The path that store My.Settings config file differ depends upon the scope that has selected and the Visual Studio version. For Microsoft Visual Studio 2008 Version 9.0.30729.4462 QFE, the config is stored in:

C:\Users\<username>\AppData\Local\<companyname>\<appdomainname>_<eid>_<hash>\<version>\user.config

Source:-

How to Assign a short-cut key (hotkey) for a LibreOffice Macro

  1. Open LibreOffice that containing the macro
  2. Click “Tools” -> “Customize…
  3. In Customize, Click “Keyboard” tab and scroll down the “Category” section until you find “LibreOffice Macros“. Select the macro.
  4. Select the function that you want to assign the shortcut key in “Function” section and find the available keys in “Shortcut Keys” area. Select the key and click “Modify” button. Click “OK

USB Drivers of FX30 and MOBITEK S80 Have Conflict — Bad_pool_caller

Problem: the USB Drivers for both FX30 and MOBITEK S80 cannot be installed in the same machine. Otherwise the below blue screen error will appear when trying to connect MOBITEK S80 3G Modem to the PC/machine.

 

Solutions: there are 3 solutions to choose:

  1. reboot Windows into “last known good configuration” (source: https://support.microsoft.com/en-my/help/4026863/windows-fix-error-0xc2-badpoolcaller);
  2. run system restore to restore Windows to the a date before FX30 USB driver was installed; or
  3. uninstall FX30 USB driver.

Test Result of MOBITEK SMS Engine — Enterprise Edition with TLS 1.2

Conclusion: MOBITEK SMS Engine — Enterprise Edition starting from version 5.8 until 8.x supports TLS 1.2 .

 

TEST DATE SMS ENGINE VERSION TLS 1.2 SSL 2.0 OS MS SQL SERVER ODBC DRIVER 64-BIT ODBC DRIVER 32-BIT .NET FRAMEWORK TEST RESULT
2020-05-14 8.3 Enabled Disabled by default Windows Server 2012 64 bit MS SQL Server 2017 Express ODBC Driver 13 for SQL Server v. 2017.140.1000.169 ODBC Driver 13 for SQL Server v. 2017.140.1000.169 4.7.2 16:50:30 SMS Engine Enterprise Edition service (8.3.0) started
16:50:35 Modem ID 8 : initialized
2020-05-20 7.1 Enabled Disabled by default Windows Server 2012 64 bit MS SQL Server 2017 Express ODBC Driver 13 for SQL Server v. 2017.140.1000.169 ODBC Driver 13 for SQL Server v. 2017.140.1000.169 4.7.2 09:47:04 SMS Engine Enterprise Edition service (7.1.0) started
09:47:09 Modem ID 8 : initialized
2020-05-20 8.3 Enabled Disabled by default Windows Server 2012 64 bit MS SQL Server 2017 Express ODBC Driver 13 for SQL Server v. 2017.140.1000.169 ODBC Driver 13 for SQL Server v. 2017.140.1000.169 4.7.2 10:29:17 SMS Engine Enterprise Edition service (8.3.0) started
10:29:22 Modem ID 8 : initialized
10:31:39 SMS Engine Enterprise Edition service (8.3.0) stopped
2020-05-21 5.8 Enabled Disabled by adding  DWORD: “Enabled” with value 0
in registry
Windows Server 2012 64 bit MS SQL Server 2017 Express ODBC Driver 13 for SQL Server v. 2017.140.1000.169 ODBC Driver 13 for SQL Server v. 2017.140.1000.169 4.6 16:10:25 SMS Engine Enterprise Edition service (version 5.8.1) started
16:10:29 Modem ID 8 : initialized
16:10:49 SMS Engine Enterprise Edition service (version 5.8.1) stopped