Page 1 of 1

Error: Couldn't connect to sql server

Posted: Tue Apr 23, 2019 5:27 pm
by naomikimani
Hi,

I am working on a trigger to auto-generate a PONumber by linking it to the RFQ number on Processmaker 3.3. However, it keeps sending the error on not connecting to sql server. Below is the trigger I am using:

$RFQNumber = @@RFQNo;

$dbhandle = mysqli_connect('localhost','wf_workflow' , 'f0p54t3bscgh','wf_workflow',"3306") or die("Couldn't connect to SQL Server");

$query = "CALL proc_generateponum('$RFQNumber')";
$result = mysqli_query($dbhandle,$query) or die(mysqli_error());
@@PONumber=$result->fetch_object()->ponum;
@@PONumber = 'T4G-PO-'.@@PONumber;
$result->free();

Re: Error: Couldn't connect to sql server

Posted: Tue Apr 23, 2019 10:57 pm
by amosbatto
mysqli_connect() y mysqli_query() only works with MySQL. If you are trying to access Microsoft SQL Server, you can use mssql_connect() and mssql_query().

However, it is much easier to create a Database Connection to your MSSQL database and then use ProcessMaker's executeQuery() function in your trigger.

Re: Error: Couldn't connect to sql server

Posted: Wed Apr 24, 2019 2:48 am
by Fredrick
I get the same error - Running ProcessMaker 3.3.1 on Linux, Ubuntu 18.04 and MySQL Version 5.6.4 - available DB engine MySql, mssql extension.

Re: Error: Couldn't connect to sql server

Posted: Wed Apr 24, 2019 8:39 pm
by amosbatto
Fredrick wrote: Wed Apr 24, 2019 2:48 am I get the same error - Running ProcessMaker 3.3.1 on Linux, Ubuntu 18.04 and MySQL Version 5.6.4 - available DB engine MySql, mssql extension.
Are you trying to connect to Microsoft SQL Server?
Are you able to create a Database Connection in ProcessMaker which connects to MSSQL ?

If not, then see if your network has a firewall that is blocking traffic and check whether the port being used by MSSQL on the other machine is open. Also try pinging from your processmaker server to your MSSQL server.