Adaptive server timed out and workaround

Just wondering if anyone has run into this issue when running query longer than 30 seconds.
the database is Microsoft SQL server.

I’m using a blank application, in onExecute I put the following:
sc_exec_sql(“query that runs a little over 30 seconds”);

the result is adaptive server timed out

workaround, I made my own connection:
$pdo = new PDO(“dblib:host=$host;dbname=$dbname”, $username, $password, array(PDO::ATTR_TIMEOUT => 120));

$sth = $pdo->prepare(“same query above”);
$sth->execute();

The result is successful.

Have anyone encountered this? any other solutions or workaround you tried?