You are really good, however I am still having the issue:
I have tried:
String SRCH_FILTER = "from table_name";
String DIR_ROOT = "";
search = new SmDmsSearch(SRCH_FILTER, DIR_ROOT);
search.setScope(1);
search.setNextItem(0);
search.setMaxItems(5000);
search.setPreviousItem(0);
search.setMaxResults(5000);
search.setPropertyNames(new String[]{"loginname"}); //new search props
Vector SortOrder = new Vector();
SortOrder.add("loginname");
int blk = 5;
Vector attrNames = new Vector();
SmDmsCursor cursor = new SmDmsCursor (SortOrder, blk, false, true);
cursor.setOffset(3);
org = dmsDir.newOrganization(orgRoot);
searchResult = org.search(search, cursor, SmDmsSearch.Forward);
With your example, the DIR_ROOT is using some ldap format, but I am connecting to database, according to doc it should be empty string.
The following is the error I am getting:
2018-03-20 18:06:58,138 [http-nio-8081-exec-1] ERROR c.a.a.i.u.********** - Search user from root [] with filter [from table_name] failed with result [[facility=4 severity=3 reason=0 status=3 message=Badly formatted command]]