Overriding the $sql_details in order to connect to a different database.

Overriding the $sql_details in order to connect to a different database.

clazetteclazette Posts: 26Questions: 7Answers: 2

We have a scenario whereby certain DataTables/Editor instances need to connect to a different database. Is there a way to deal with this? I need to override the default $sql_details settings in config.php.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,824Questions: 1Answers: 10,131 Site admin
    Answer ✓

    There are a few options:

    1. If you defined $sql_details before you include the Bootstrap.php file it will use your $sql_details rather than the one from config.php.
    2. Create a new Database instance new Database( $connection_details ) with the array of options you need.

    Allan

  • clazetteclazette Posts: 26Questions: 7Answers: 2

    Thank you, Allan. That was the approach I was taking. I just wanted to make sure I wasn't missing something.

This discussion has been closed.