error try to connect to an other db

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Silverstripe Version: 4.1 (php7)

I need o connect my project to an external db to execute some query.
What is wrong?

Error: Call to a member function isQueryDLL() on null

Details of your query go here

use  SilverStripe\ORM\Connect\MySQLDatabase;

global $mydb;
$mydb=new MySQLDatabase(array(