Skip to content

sqlSrvConfig with named instance #10

@PeuX

Description

@PeuX

Hi,
First thank for your work.
I'm on a project that use your PdoServiceProvider and i detect a problem when you use it with sqlsrv and some named instance.
In named instance the port is dynamcally assigned, but in sqlSrvConfig you set the default port to 1433.
If in your config file you set port to null you've got a wrong server string that look like
new PDO('sqlsrv:localhost,; ...
(the comma after localhost is the problem).
And if you do not set the port you got a TCP error :
TCP Provider: No connection could be made because the target machine actively refused it.

I suggest this in your sqlSrvConfig file, L.34 :

$params['server'] = $params['host'];
if(!empty($params['port'])) $params['server'] .= ",".$params['port'];

so If the user want, he can define the value null for the port.

Bye.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions