Given up on docker, going with mamp, but on connecting to database (mssql) I get "MAX_PROVS: Connection string is not valid"

Is octoberCMS compatible with mssql? starting to think that its not

been trying to set up my project for a few days, and mssql refuses to connect, each time I solve one issue, another one pops up

has anyone seen this error before?

“MAX_PROVS: Connection string is not valid?”

Hi @michael,

Sorry to see the trouble you are having with this. The error suggests that the database hostname, database name, or authentication credentials are invalid.

@daftspunky

With the help of a more experienced colleague, we have found the issue and fixed,

Problem seems to be because, while October is putting together the connection string, it adds an extra comma between the host and the port when there is no dblib library present in the available drivers.

This can be found in the SetupHelper.php file, inside the checkDatabase function, case ‘sqlsrv’.

Should I open a ticket for this, so that it can be fixed? Or just let it be?

also, the connection string is missing the Encrypt and TrustServerCertificate parameters, which are required by odbc 18

Here is a reference to the code you mentioned, if you can advise precisely the issue that would be ideal, so we can patch the code.

case 'sqlsrv':
$availableDrivers = PDO::getAvailableDrivers();
$_port = $port ? ','.$port : '';
if (in_array('dblib', $availableDrivers)) {
    $dsn = 'dblib:host='.$host.$_port.';dbname='.$name;
}
else {
    $dsn = 'sqlsrv:Server='.$host.(empty($port) ? '':','.$_port).';Database='.$name;
}
break;

Otherwise, we can just remove the validation and let Laravel handle it.

@daft

well if you notice, it calls $_port in both the if and the else statement, where as in the else statement, it should only call $port

so, when it goes to the else statement, it always adds an extra comma after the host

it adds the comma in both the assignment of $_port, and in the else statement, so the connection string has two commas and brakes

1 Like

Thanks, I see it now.

edit: fixed