Microsoft SQL Server error with Laravel: Why does this solve my error?

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.


, :

nvarchar


:

:


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:

enter image description here

+4
2

tds version = 4.2 FreeTDS, , UTF-8 SQL Server. . :

http://www.freetds.org/userguide/choosingtdsprotocol.htm

nvarchar UTF-8 .

, tds version = 8.0 , , FreeTDS. , tds version = 7.2 tds version = 7.3, , FreeTDS . FreeTDS, tsql -C .

UPDATE: tds version = 7.2.

+4

Well FreeTDS 4.2 . . .

. FreeTDS PHP . PHP.

ODBC11 ODBC13, Linux.

: - FreeTDS. SQL Server, . .

0

All Articles