0

I try to connect MS SQL remote external database. But I got this error. I am stuck with this error, Do I miss something, how to fix this error?

"message": "SQLSTATE[HY001] Unable to allocate sufficient memory (http://insharp.database.windows.net/:1433) (severity 8)", "exception": "Doctrine\DBAL\Driver\PDO\Exception", "file": "/var/www/analytics/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php", "line": 18, "trace": [ *

'sqlsrv' => [
            'driver' => 'sqlsrv',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', 'localhost'),
            'port' => env('DB_PORT', '1433'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'prefix' => '',
            'prefix_indexes' => true,
        ], 
DB::purge('dynamic');
        Config::set('database.connections.dynamic.driver', $request->db_type);
        Config::set('database.connections.dynamic.host', $request->host);
        Config::set('database.connections.dynamic.port', $request->port);
        Config::set('database.connections.dynamic.database', $request->db_name);
        Config::set('database.connections.dynamic.username', $request->user_name);
        Config::set('database.connections.dynamic.password', $request->password);
        DB::reconnect('dynamic');

Thanks in advance.

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • 1
    Your system is simply out of RAM, once you checked and ensured that you have at least 1 GB of RAM, you just need to ensure you're **not** trying to insert big file/data into the DB (though, even small file in DB is bad practice). – Top-Master Mar 02 '23 at 11:50
  • My system has 4 GB RAM and I checked there is an enough space. – Wishwajith Milinda Mar 02 '23 at 11:56
  • Has 4 GB of RAM in total, or has 4 GB remaining? I meant above that it should have "at least 1 GB of RAM" remaining, once that's the case, ensure your query/insert/update is not too big. – Top-Master Mar 02 '23 at 11:59
  • System has 1.9 GB remaining space, I think that enough, isn't It? – Wishwajith Milinda Mar 05 '23 at 10:33
  • Normally that should be enough, see also: [Laravel - SQLSTATE\[HY001\] Unable to allocate sufficient memory - MsSQL](https://stackoverflow.com/questions/65395463/laravel-sqlstatehy001-unable-to-allocate-sufficient-memory-mssql) – Top-Master Mar 05 '23 at 13:01

0 Answers0