new to laravel framework, I am running multiple database connections for a project I am working on. Just a simple test against one of the mysql instance,
<p>{{ $data2 = DB::connection('mysql2')->table('test')->get() }}</p>
gives a simple dump but when run simmilar test against the ms sql server 2012, it errors out
<p>{{ $data3 = DB::connection('sqlsrv')->table('test1')->get() }}</p>
The error is:
ErrorException in helpers.php line 519:
Method Illuminate\Support\Collection::__toString() must return a string value
my db config is similar to other examples I have seen posted online.
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'SQL3.company.ca'),
'database' => env('DB_DATABASE', 'test'),
'username' => env('DB_USERNAME', 'test'),
'password' => env('DB_PASSWORD', '#######'),
'collation' => 'SQL_Latin1_General_CP1_CI_AS',
'charset' => 'latin1',
'prefix' => '',
],
Did I set up something wrong? any direction I should be looking at?
{{dd(DB::connection('sqlsrv')->table('test1')->get()) }}not goodif get data logic in view u should write model or controllerp>{{ $data4 = DB::connection('sqlsrv')->table('test1')->select(DB::RAW('username'))->get() }}</p>to the sql 2012 server, and I started testing/working on connection to the old sql 2005 server. Returned this morning, and the successful connection wasn't working anymore and getting the 'SQLSTATE[01002] Adaptive Server connection failed (severity 9)' so something I did last night or servers changed last night.. so much fun