@Evgeny Shvarov

Unfortunately, I have not yet found a documented and [Not Internal] way out of the box to see not only the text of the request, but also the values of its input parameters.

PS: take a look at the methods of the %SYSTEM.SQL.xDBC class.
Here is an example of the log for the query above (from DbVisualizer):

        SQL text (raw from client): 1 lines
        line 1: SELECT * FROM del . a WHERE id < :%qpar(1)
        Var Types: Parameter 1: Constant of type INTEGER
        INPUT params:
          %qpar(1) = 3

If auditing is enabled, you can see the query without the actual parameter values.
To copy the query to the SQL query tool, the query will also have to be cleaned of garbage.

For example, there is the following query

select * from del.a where id<3

From SMP:

Event: DynamicStatementQuery
Event Data: SELECT * FROM del . a WHERE id ?

From DbVisualizer:

Event: XDBCStatementQuery
Event Data: SELECT * INTO :i%%col1:i%%col2:i%%col3 FROM del . a WHERE id :%qpar(1)

Rather, the discussion was about out-of-the-box equivalents of some SQL functions, so that programmers wouldn't have to reinvent the wheel. Furthermore, the routine of ^%qarfunc is undocumented.

For example, making an Object Script analog of VECTOR_COSINE for integer vectors yourself is a non-trivial task, given that $VECTOROP doesn't support the integer type.

Sometimes it's easier to use embedded SQL.

LPAD is a SQL function, not an ObjectScript function, which is why it didn't work for you if you replaced the single quotes with double quotes.

USER>write ">"_LPAD(1,10,"0")_"<"
><
USER>write ">"_$$lpad^%qarfunc(1,10,"0")_"<"
>0000000001<

There are two ways to solve the problem: using embedded SQL or an analog of LPAD for ObjectScript, for example:

CREATE TABLE example_table (
    id VARCHAR(10PRIMARY KEY,
    normalized_id VARCHAR(10COMPUTECODE {
        &sql(select LPAD(:{id}, 10, '0'into :{*})
    }
    COMPUTEONCHANGE(id))

This should be checked on your environment, depending on the versions of Caché, Windows, and Microsoft SQL Server used. I have already provided the code for this above.

I would advise you to first make sure that you are using the latest version of Caché (and the ODBC/JDBC driver), which has fixed many bugs, including various memory leaks:
Caché® and Ensemble® Change Notes (2018.1.11)

In addition, you may find the New Method $SYSTEM.Util.CleanDeadJobs() useful.

Here is what is in the documentation for Caché:

Disable Query Timeout — Optional. If selected, causes the ODBC client driver to ignore the value of the ODBC query timeout setting.

The ODBC query timeout setting specifies how long a client should wait for a specific operation to finish. If an operation does not finish within the specified time, it is automatically cancelled. The ODBC API provides functions to set this timeout value programmatically. Some ODBC applications, however, hard-code this value. If you are using an ODBC application that does not allow you to set the timeout value and the timeout value is too small, you can use the Disable Query Timeout option to disable timeouts.

java.sql Exceptions
The following exceptions are listed here for completeness, but are not required and are never used:
...
SQLTimeoutException
...

You can empirically verify all your considerations by calling a custom stored procedure from Microsoft SQL Server, for example:

Class dc.a Abstract ]
{

Query DbgSqlProc(
  qMaxRows 10,
  qTimeWait As %SmallInt 3As %Query(ROWSPEC "nrow:%Integer,name:%String") [ SqlProc ]
{
}

ClassMethod DbgSqlProcExecute(
  ByRef qHandle As %Binary,
  qMaxRows 10,
  qTimeWait As %SmallInt 3As %Status
{
  #define Log(%s) Set ^dbgSqlProc(qHandle("id"),%s)=$ZDateTime($NOW(),1,1,6)
  
  Set qHandle("id")=$Increment(^dbgSqlProc)
  Set qHandle("qMaxRows")=qMaxRows
  Set qHandle("qTimeWait")=qTimeWait

  $$$Log("1_Execute")

  For i=1:1:qMaxRows Set qHandle(i)=$ListBuild(i,"name"_i)
  Set qHandle=0
  
  ; Hang qHandle("qTimeWait")*3
  
  Quit $$$OK
}

ClassMethod DbgSqlProcFetch(
  ByRef qHandle As %Binary,
  ByRef Row As %List,
  ByRef AtEnd As %Integer 0As %Status PlaceAfter = DbgSqlProcExecute ]
{
  $$$Log("2_Fetch")
  
  If qHandle>qHandle("qMaxRows"{
    Set Row=""
    Set AtEnd=1
  }else{
    Set Row=qHandle($Increment(qHandle))
    Hang qHandle("qTimeWait")
  }
  Quit $$$OK
}

ClassMethod DbgSqlProcClose(ByRef qHandle As %BinaryAs %Status PlaceAfter = DbgSqlProcExecute ]
{
  $$$Log("3_Close")
  
  Quit $$$OK
}

}

Example of a call: select * from dc.a_DbgSqlProc(11,5)

See Customized Class Queries

 
dc.onetomany.PKG
USER>##class(dc.onetomany.companies).Test()
17000 <- 17000
7000 <- 7000
current ID = 111
current ID = 500
current ID = 501

Interestingly, if I try your examples, I can recreate the ambiguity error, but then get an error when attempting to specify the full param specification

What is your version of IRIS and .NET?
I have IRIS 2025.3CE and .NET 8.0/Framework 4.6.2 - the examples above work flawlessly and give respectively 1, 0, 1 as indicated in the comments.

This is also possible:

USER>gw $System.external.getDotNetGateway()
USER>gw.invoke("System.Convert","ToBoolean(System.UInt64)",123)
1
USER>

Since you manage the ID yourself, in the general case it may not necessarily be a simple counter, but, for example, a Fibonacci sequence.
If the source code of the class or table is available, it is better to see how the ID is generated in it. If there is no source code, and you are sure that this is a simple counter, then in my opinion it would be easier to make a standard ID and let IRIS manage it itself.

    var irisReference = new IRISReference("");
    iris.ClassMethodStatusCode("TestClasses.TestClass", "Method1", irisReference);
    var pReturn = (IRISObject)irisReference.value;
    var list = (IRISObject)pReturn.Get("Entries");
    for (var i = 1; i <= list.InvokeLong("Count"); i++)
    {
        var entry = (IRISObject)list.InvokeObject("GetAt", i);
        Console.WriteLine(entry.GetString("Username"));

    }

gateway.new() calls a constructor, but the System.Convert class has no constructors.

To call a static method, use gateway.invoke(), but keep in mind that if you call the following code, an error will occur "Unable to resolve method overloading ambiguity":

write netGate.invoke("System.Convert","ToBoolean",123)

To avoid it, specify the name of the method with the full specification of the parameters, for example:

gw $System.external.getDotNetGateway()
gw.invoke("System.Convert","ToBoolean(int)",123),! ; -> 1
gw.invoke("System.Convert","ToBoolean(string)","false"),! ; -> 0
gw.invoke("System.Convert","ToBoolean(string)","true"),! ; -> 1

PS: see Mapping Specification (pay special attention to the sections "Overloaded Methods" and "Restrictions")