catfan / Medoo

The lightweight PHP database framework to accelerate the development.
https://medoo.in
MIT License
4.84k stars 1.15k forks source link

DSN Connection in Medoo #572

Closed hanns08 closed 7 years ago

hanns08 commented 7 years ago

How to write DSN Connection in medoo. I am using MSSQL server.

$database = new medoo([

'dsn' => [

    'driver' => 'SQLSERVER',

    'server' => '.',
    'port' => '8886'
],

'database_type' => 'sql',

'username' => 'sa',
'password' => 'xxxxx'

]);

that is mine connection, and it came error "invalid data source name" please tell me how to solve this problem

catfan commented 7 years ago

Just check out the documentation.

dsn option is for building customized DSN string, but for most case, just change the database_type to mssql and config the correct server, username, password or port. It it enough.