This commit is contained in:
Naden
2026-04-25 04:48:32 +07:00
parent 7e9668a552
commit ee40989c37
2 changed files with 28 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Controllers;
class TestDb extends BaseController
{
public function test()
{
try {
$db = \Config\Database::connect();
$query = $db->query('SELECT 1');
echo "Default DB connection successful\n";
} catch (\Exception $e) {
echo "Default DB connection failed: " . $e->getMessage() . "\n";
}
try {
$db = \Config\Database::connect('postgre');
$query = $db->query('SELECT 1');
echo "Postgre DB connection successful\n";
} catch (\Exception $e) {
echo "Postgre DB connection failed: " . $e->getMessage() . "\n";
}
die;
}
}