#1337
Answered
2 weeks ago
Lee1994
Answers: 2

DB connection without config file entry

Hi there again!

I am working on data migration tool and I need to use raw DB connection using Jet\Db. I know where is the Jet\Db config file is and how to configure it.

But for my use it would be better to create ad-hoc database connection - without config file entry.

Is it possible?

Thanks!

Answers (2)

#1465
2 weeks ago
PHPJetTeam
0

Hello :-)

It's definitely possible. Here is an example:


$config Factory_Db::getBackendConfigInstance([
    
'name' => 'connection-name',
    
'driver' => 'mysql',
    
'host' => 'localhost',
    
'port' => 3306,
    
'dbname' => 'db-name',
    
'charset' => 'utf8',
    
'username' => 'username',
    
'password' => 'password',
]);
$db Factory_Db::getBackendInstance$config );

Have a nice day!

#1466
10 days ago
Lee1994
0

Perfect, thanks!

Your Answer
Privacy Policy