Working with two databases in Laravel [closed]

6

I'm creating an application that needs to connect to 2 different databases. A database I'm creating (MySQL) and a database I got ready that I have permission to query only (SQL Server). The purpose of the application is to query the data of the SQL Server database, to do operations with that data and to store it in the database MySQL

I'm very new to Laravel and I do not know if it's possible to work with the 2 banks. Has anyone done this or does it work?

UPDATE:

I tried to do this link but it gives an error.

File database.php:

'default' => 'mysql',
'connections' => array(


        'mysql' => array(
            'driver'    => 'mysql',
            'host'      => 'localhost',
            'database'  => 'matriculas',
            'username'  => '*****',
            'password'  => '*****',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ),

        'sqlsrv' => array(
            'driver'   => 'sqlsrv',
            'host'     => '10.31.24.2',
            'database' => 'SIGA',
            'username' => '******',
            'password' => '*****',
            'prefix'   => '',
        ),

    ),

Controller:

class MatriculasController extends BaseController{

        public function formulario(){

        $teste= DB::connection('sqlsrv')->select('select * from supervisor.PESSOA');

        dd($teste);

    }

}

The error:

Erro no servidor (500)

UPDATE 2:

I noticed that the problem is with the driver "sqlsrv" that does not have on the server. The server is a CentOS 6 with PHP 5.4.45. I do not know how to install this driver for this version of PHP, I can not find the corresponding RPM package. Does anyone have any idea what to do ??

    
asked by anonymous 19.10.2015 / 12:08

0 answers