I am creating an application in Laravelthat accesses information stored in a remote database Microsoft SQL Server.
And I ran into an error that I solved; but I don’t quite understand why ...
Problem
I created a "users" table in the database in Microsoft SQL Serverto use the application through the login system: Works well.
My job is to display information from tables found in an existing database, in Microsoft SQL Server... so I created modelone of these tables - called, for example Sales- BUT , when I try to request information with:
$sale = Sales::find("1");
I get the following error:
SQLSTATE[HY000]: General error: 4004 General SQL Server error: Check messages from the SQL Server [4004] (severity 16) [(null)]
Eloquent Fluent.
, :

:
:
1) /etc/freetds/freetds.conf
tds:
tds version = 4.2
tds version = 8.0
:
client charset = UTF-8
2) /etc/php5/apache2/php.ini
mssql.charset = "UTF-8"
default_charset = "UTF-8"
: ?
, , :
Laravel db- ( ) Sql-, Unicode MSSQL. (1,2) -
, - nvarchar... , nvarchar, ...
Laravel: config/database.php
[...]
'default' => 'sqlsrv',
[...]
'sqlsrv' => array(
'driver' => 'sqlsrv',
'host' => 'foo.bar',
'database' => 'MyDataBase',
'username' => 'UserName',
'password' => 'MySecret',
'prefix' => ''
)
[...]
, configuration sqlsrv, FreeTDS.
tsql -C:
