update
This commit is contained in:
27
app/Controllers/TestDb.php
Normal file
27
app/Controllers/TestDb.php
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user