CLI Documentation Help

30 views
Skip to first unread message

Mathew Tasalloti

unread,
Dec 18, 2024, 4:25:13 PM12/18/24
to Fusio
Hi Christoph and gang !

I'm trying to build our Fusio 5 server using ansible.  I would like to create connections and users via the CLI.  For the users it all works.  But I'm having a heck of a time creating a connection via CLI.

I created a connection.json file with my connection info:

{ "name": "G-DB",
  "class": "Fusio.Adapter.Sql.Connection.Sql",
  "config": { "host": "10.0.0.98",
              "driver": "pdo-mysql",
              "port": "3306",
              "username": "db-user",
              "password": "password",
              "database": "mydb"
            }
}


Then I use this command:   bin/fusio connection:create connection.json

But I get this error:  The options 'driver' or 'driverClass' are mandatory if no PDO instance is given to DriverManager::getConnection(). in /var/www/html/fusio/vendor/doctrine/dbal/src/Exception.php on line 79

Questions:
1) Any idea what else I need to define my connection properly for the CLI ?
2) Any documentation on the CLI that I can reference ?  I've looked everywhere.

Thank you very much in advance!
Mathew

Christoph Kappestein

unread,
Dec 19, 2024, 12:58:23 PM12/19/24
to Fusio
Hi Mathew,

in general everything looks fine, could you try to use "pdo_mysql" instead of "pdo-mysql", this should work.

best regards
Christoph

Mathew Tasalloti

unread,
Dec 21, 2024, 3:02:54 PM12/21/24
to Fusio
Hi Christoph,

Thanks for this but I'm still getting the same error.  I might just have to create these by hand then export them using "deploy:export" as another tactic.

Here is the error I'm getting in case you've seen it before:

>  sudo php /var/www/fusio/bin/fusio connection:create connection.mysql

The options 'driver' or 'driverClass' are mandatory if no PDO instance is given to DriverManager::getConnection(). in /var/www/fusio/vendor/doctrine/dbal/src/Exception.php on line 79

#0 /var/www/fusio/vendor/doctrine/dbal/src/DriverManager.php(221): Doctrine\DBAL\Exception::driverRequired()
#1 /var/www/fusio/vendor/doctrine/dbal/src/DriverManager.php(186): Doctrine\DBAL\DriverManager::createDriver()
#2 /var/www/fusio/vendor/fusio/adapter-sql/src/Connection/Sql.php(67): Doctrine\DBAL\DriverManager::getConnection()
#3 /var/www/fusio/vendor/fusio/impl/src/Service/Connection.php(83): Fusio\Adapter\Sql\Connection\Sql->getConnection()
#4 /var/www/fusio/vendor/fusio/impl/src/Backend/Action/Connection/Create.php(56): Fusio\Impl\Service\Connection->create()
#5 /var/www/fusio/vendor/fusio/engine/src/Processor.php(67): Fusio\Impl\Backend\Action\Connection\Create->handle()
#6 /var/www/fusio/vendor/fusio/impl/src/Service/Action/Invoker.php(78): Fusio\Engine\Processor->execute()
#7 /var/www/fusio/vendor/fusio/impl/src/Controller/ActionController.php(60): Fusio\Impl\Service\Action\Invoker->invoke()
#8 /var/www/fusio/vendor/fusio/impl/src/Framework/Filter/ActionExecutor.php(77): Fusio\Impl\Controller\ActionController->execute()
#9 /var/www/fusio/vendor/psx/http/src/Filter/FilterChain.php(86): Fusio\Impl\Framework\Filter\ActionExecutor->handle()

and the connection.mysql file looks like this now:

{ "name": "mysql-connection",

  "class": "Fusio.Adapter.Sql.Connection.Sql",
  "config": { "host": "10.0.0.98",
              "driver": "pdo_mysql",

              "port": "3306",
              "username": "db-user",
              "password": "password",
              "database": "mydb"
            }
}

Thanks,
Mathew

Christoph Kappestein

unread,
Jan 1, 2025, 12:54:59 PMJan 1
to Fusio
Hi Mathew,

ok, I just looked at the config closer and could you try to use "type" instead of "driver" as key in your config, since we use this key at the connection s.
https://github.com/apioo/fusio-adapter-sql/blob/master/src/Connection/Sql.php#L57

best regards
Christoph
Reply all
Reply to author
Forward
0 new messages